Click here to Skip to main content
15,903,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Multithreading Oddness Pin
kerrywes22-Sep-05 12:57
kerrywes22-Sep-05 12:57 
GeneralRe: Multithreading Oddness Pin
Joel Holdsworth22-Sep-05 21:53
Joel Holdsworth22-Sep-05 21:53 
GeneralRe: Multithreading Oddness Pin
Laffis22-Sep-05 22:02
Laffis22-Sep-05 22:02 
GeneralRe: Multithreading Oddness Pin
Steen Krogsgaard22-Sep-05 22:44
Steen Krogsgaard22-Sep-05 22:44 
GeneralRe: Multithreading Oddness Pin
kerrywes23-Sep-05 6:11
kerrywes23-Sep-05 6:11 
AnswerRe: Multithreading Oddness Pin
cmk25-Sep-05 21:06
cmk25-Sep-05 21:06 
QuestionATL :( Pin
Eytukan22-Sep-05 6:34
Eytukan22-Sep-05 6:34 
AnswerRe: ATL :( Pin
peterchen22-Sep-05 8:23
peterchen22-Sep-05 8:23 
char is by default "signed" in VC, and "unsigned" in MIDL.

(giveaway: the compiler misses a function 'long __stdcall IStATL::ReturnString(unsigned char *,unsigned char *)' )

However, to pass strings across a COM interface, your MIDL declaration is not sufficient. (The bad thing is that in most cases it will go well, but can fail in another scenario quickly).

zero-terminated strings (those used in C) are not natively supported in COM. Though you can coax MIDL into using them, many clients will have problems with this.

The normal way to pass strings through a COM interface are BSTR strings. They are unicode strings, and must be handled using SysAllocString and it's companion functions.

Here are the basic rules of working with BSTR's:

- You must not free your [in] BSTR. the pointer is valid only during the function call (if you need to store the pointer, you need to copy it)

- You must "allocate and forget" the [out] BSTR

- NULL is a valid BSTR and must be treated like an empty string


VC offers a support class, _bstr_t that makes handling BSTR's (mostly) easier.





Pandoras Gift #44: Hope. The one that keeps you on suffering.
aber.. "Wie gesagt, der Scheiss is' Therapie"
boost your code || Fold With Us! || sighist | doxygen

Questionfile associations Pin
mikeorama1234522-Sep-05 5:51
mikeorama1234522-Sep-05 5:51 
AnswerRe: file associations Pin
David Crow22-Sep-05 7:12
David Crow22-Sep-05 7:12 
Generalwhat does the DDEXEC part do? Pin
peterchen22-Sep-05 8:27
peterchen22-Sep-05 8:27 
GeneralRe: what does the DDEXEC part do? Pin
David Crow22-Sep-05 8:38
David Crow22-Sep-05 8:38 
QuestionDelete file from temporary internet files? Pin
DanYELL22-Sep-05 5:42
DanYELL22-Sep-05 5:42 
AnswerRe: Delete file from temporary internet files? Pin
Michael Dunn22-Sep-05 6:19
sitebuilderMichael Dunn22-Sep-05 6:19 
AnswerRe: Delete file from temporary internet files? Pin
Chris Losinger22-Sep-05 6:22
professionalChris Losinger22-Sep-05 6:22 
AnswerRe: Delete file from temporary internet files? Pin
Ravi Bhavnani22-Sep-05 6:36
professionalRavi Bhavnani22-Sep-05 6:36 
GeneralRe: Delete file from temporary internet files? Pin
DanYELL22-Sep-05 14:47
DanYELL22-Sep-05 14:47 
GeneralRe: Delete file from temporary internet files? Pin
Ravi Bhavnani23-Sep-05 1:56
professionalRavi Bhavnani23-Sep-05 1:56 
QuestionTray Icon Menu Command handling in MFC Pin
pritamkd22-Sep-05 5:06
pritamkd22-Sep-05 5:06 
AnswerRe: Tray Icon Menu Command handling in MFC Pin
Laffis22-Sep-05 5:57
Laffis22-Sep-05 5:57 
AnswerRe: Tray Icon Menu Command handling in MFC Pin
Laffis22-Sep-05 6:01
Laffis22-Sep-05 6:01 
AnswerRe: Tray Icon Menu Command handling in MFC Pin
David Crow22-Sep-05 7:31
David Crow22-Sep-05 7:31 
GeneralRe: Tray Icon Menu Command handling in MFC Pin
pritamkd23-Sep-05 3:20
pritamkd23-Sep-05 3:20 
GeneralRe: Tray Icon Menu Command handling in MFC Pin
David Crow23-Sep-05 3:51
David Crow23-Sep-05 3:51 
GeneralRe: Tray Icon Menu Command handling in MFC Pin
pritamkd23-Sep-05 3:59
pritamkd23-Sep-05 3:59 

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.