Click here to Skip to main content
15,919,893 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionconverting char* to TCHAR? Pin
Member 227578522-Sep-05 7:48
Member 227578522-Sep-05 7:48 
AnswerRe: converting char* to TCHAR? Pin
Joe Woodbury22-Sep-05 7:56
professionalJoe Woodbury22-Sep-05 7:56 
Questionfixed length hexidecimal Pin
Ryan Riel22-Sep-05 7:25
Ryan Riel22-Sep-05 7:25 
AnswerRe: fixed length hexidecimal Pin
David Crow22-Sep-05 7:40
David Crow22-Sep-05 7:40 
GeneralRe: fixed length hexidecimal Pin
Ryan Riel22-Sep-05 7:51
Ryan Riel22-Sep-05 7:51 
QuestionMultithreading Oddness Pin
Joel Holdsworth22-Sep-05 6:56
Joel Holdsworth22-Sep-05 6:56 
AnswerRe: Multithreading Oddness Pin
Joel Holdsworth22-Sep-05 7:22
Joel Holdsworth22-Sep-05 7:22 
GeneralRe: Multithreading Oddness Pin
peterchen22-Sep-05 8:14
peterchen22-Sep-05 8:14 
GeneralRe: Multithreading Oddness Pin
Joel Holdsworth22-Sep-05 9:44
Joel Holdsworth22-Sep-05 9:44 
AnswerRe: Multithreading Oddness Pin
Laffis22-Sep-05 11:55
Laffis22-Sep-05 11:55 
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 

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.