Click here to Skip to main content
15,916,463 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: LPDISPATCH help me Pin
Anthony_Yio23-Jun-04 16:33
Anthony_Yio23-Jun-04 16:33 
GeneralSetting a Custom Background for the Main Menu Bar Pin
Steve Thresher23-Jun-04 9:13
Steve Thresher23-Jun-04 9:13 
GeneralWant help in learning Unicode Usage Pin
Member 119592223-Jun-04 8:53
Member 119592223-Jun-04 8:53 
GeneralString formatting question Pin
Nick Parker23-Jun-04 8:49
protectorNick Parker23-Jun-04 8:49 
GeneralRe: String formatting question Pin
palbano23-Jun-04 8:59
palbano23-Jun-04 8:59 
GeneralRe: String formatting question Pin
Nick Parker23-Jun-04 9:17
protectorNick Parker23-Jun-04 9:17 
GeneralRe: String formatting question Pin
PJ Arends23-Jun-04 10:34
professionalPJ Arends23-Jun-04 10:34 
GeneralRe: String formatting question Pin
cmk23-Jun-04 10:28
cmk23-Jun-04 10:28 
Ummm, there is a problem ...

Aside from the BSTR != wchar_t*, what do you expect wsprintf to do ?
I mean it's used to take a format string (path) and create a result - you haven't specified a result string. Are you expecting it to modify path in place (it won't even with correct types) ?

From MSDN :
typedef OLECHAR * BSTR;
These strings are zero-terminated, and in most cases they can be treated just like OLECHAR* strings. However, you can query a BSTR for its length rather than scan it, so it can contain embedded null characters. The length is stored as a 32-bit integer at the memory location preceding the data in the string.

The 32-bit is placed before the BSTR value so you don't need to worry about it, just cast the BSTR to a wchar_t*.

e.g. (without error checking)
wchar_t res[500];
BSTR path = NULL;
int num = 1;
path = SysAllocString(L"//errors/error[@id='%i']");
wsprintf(res, (wchar_t*)path, num);


...cmk

Save the whales - collect the whole set
GeneralRe: String formatting question Pin
Michael Dunn23-Jun-04 13:57
sitebuilderMichael Dunn23-Jun-04 13:57 
QuestionWhat is SetModifiedFlag() In SDI Project Pin
jerry1211a23-Jun-04 8:42
jerry1211a23-Jun-04 8:42 
AnswerRe: What is SetModifiedFlag() In SDI Project Pin
palbano23-Jun-04 9:04
palbano23-Jun-04 9:04 
AnswerRe: What is SetModifiedFlag() In SDI Project Pin
Blake Miller23-Jun-04 9:06
Blake Miller23-Jun-04 9:06 
GeneralProb with Visual Studio Pin
Anonymous23-Jun-04 8:39
Anonymous23-Jun-04 8:39 
GeneralRe: Prob with Visual Studio Pin
PJ Arends23-Jun-04 10:30
professionalPJ Arends23-Jun-04 10:30 
QuestionVCToolkit and DevStudio 6? Pin
yurig23-Jun-04 8:27
yurig23-Jun-04 8:27 
AnswerRe: VCToolkit and DevStudio 6? Pin
Ryan Binns23-Jun-04 18:15
Ryan Binns23-Jun-04 18:15 
GeneralRe: VCToolkit and DevStudio 6? Pin
Yuri Gershanov24-Jun-04 14:22
Yuri Gershanov24-Jun-04 14:22 
GeneralCustom background for application Pin
suiram4023-Jun-04 7:33
suiram4023-Jun-04 7:33 
GeneralRe: Custom background for application Pin
PJ Arends23-Jun-04 10:28
professionalPJ Arends23-Jun-04 10:28 
GeneralProblem during compilation of EchoServer Pin
Member 119565823-Jun-04 6:54
Member 119565823-Jun-04 6:54 
GeneralRe: Problem during compilation of EchoServer Pin
jmkhael23-Jun-04 7:05
jmkhael23-Jun-04 7:05 
GeneralRe: Problem during compilation of EchoServer Pin
Member 119565823-Jun-04 8:09
Member 119565823-Jun-04 8:09 
GeneralCan't create a DLL dialog box object Pin
King Coffee23-Jun-04 6:39
King Coffee23-Jun-04 6:39 
GeneralRe: Can't create a DLL dialog box object Pin
suiram4023-Jun-04 7:58
suiram4023-Jun-04 7:58 
GeneralRe: Can't create a DLL dialog box object Pin
King Coffee23-Jun-04 14:30
King Coffee23-Jun-04 14:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.