Click here to Skip to main content
15,920,217 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How do I include a library in with my source code in VC7.0 Pin
Gary R. Wheeler26-Feb-03 13:17
Gary R. Wheeler26-Feb-03 13:17 
AnswerRe: How do I include a library in with my source code in VC7.0 Pin
Anders Molin26-Feb-03 14:48
professionalAnders Molin26-Feb-03 14:48 
GeneralWindowsXP Down/Uploadrate Pin
pma26-Feb-03 11:12
pma26-Feb-03 11:12 
GeneralDirectShow - drawing on window Pin
Jakub Misek26-Feb-03 10:49
Jakub Misek26-Feb-03 10:49 
GeneralRe: DirectShow - drawing on window Pin
Chris Richardson26-Feb-03 11:52
Chris Richardson26-Feb-03 11:52 
GeneralRe: DirectShow - drawing on window Pin
Jakub Misek27-Feb-03 9:26
Jakub Misek27-Feb-03 9:26 
QuestionHow correctly override WinAPI function OleUIPasteSpecial for Microsoft Layer for Unicode Pin
Valera24117626-Feb-03 10:49
Valera24117626-Feb-03 10:49 
AnswerRe: How correctly override WinAPI function OleUIPasteSpecial for Microsoft Layer for Unicode Pin
KaЯl26-Feb-03 23:59
KaЯl26-Feb-03 23:59 
Valera241176 wrote:
How to get them to translate from Unicode to ANSI using WideCharToMultiByte?

You have to use WideCharToMultiByte twice, one to know the size needed and one to do the transformation.

LPWSTR lpszMsg;<br />
[...].br />
// First calculation of the size needed to store the converted string<br />
int iCharSize = WideCharToMultiByte(CODE_PAGE, 0, lpszMsg, -1, NULL, 0, NULL, NULL);<br />
// Alloc a ANSI string<br />
LPSTR formatANSI = (LPSTR) HeapAlloc(GetProcessHeap(), 0, sizeof(char) * iCharSize);<br />
// convert<br />
WideCharToMultiByte(CODE_PAGE, 0, lpszMsg, -1, formatANSI, iCharSize, NULL, NULL);<br />
//...<br />
// use FormatAnsi there<br />
//...<br />
// Free the ANSI string<br />
HeapFree(GetProcessHeap(), 0, formatANSI);


HTH,

K.






Angels banished from heaven have no choice but to become demons
Cowboy Bebop

GeneralCalling TransmitFile with a large file Pin
JRivord26-Feb-03 10:29
JRivord26-Feb-03 10:29 
GeneralRe: Calling TransmitFile with a large file Pin
valikac26-Feb-03 16:36
valikac26-Feb-03 16:36 
GeneralRe: Calling TransmitFile with a large file Pin
JRivord26-Feb-03 16:57
JRivord26-Feb-03 16:57 
GeneralRe: Calling TransmitFile with a large file Pin
valikac26-Feb-03 17:01
valikac26-Feb-03 17:01 
QuestionChild within child? Pin
clintsinger26-Feb-03 10:27
clintsinger26-Feb-03 10:27 
AnswerRe: Child within child? Pin
Alvaro Mendez26-Feb-03 11:20
Alvaro Mendez26-Feb-03 11:20 
QuestionAdding/Removing Computers from a domain???? Pin
dautb26-Feb-03 10:27
dautb26-Feb-03 10:27 
GeneralIs it possible to link dll statically without .lib Pin
Valera24117626-Feb-03 10:25
Valera24117626-Feb-03 10:25 
GeneralRe: Is it possible to link dll statically without .lib Pin
Alvaro Mendez26-Feb-03 10:35
Alvaro Mendez26-Feb-03 10:35 
GeneralRe: Is it possible to link dll statically without .lib Pin
Valera24117626-Feb-03 10:56
Valera24117626-Feb-03 10:56 
GeneralRe: Is it possible to link dll statically without .lib Pin
Alvaro Mendez26-Feb-03 11:09
Alvaro Mendez26-Feb-03 11:09 
GeneralRe: Is it possible to link dll statically without .lib Pin
Valera24117626-Feb-03 11:22
Valera24117626-Feb-03 11:22 
GeneralRe: Is it possible to link dll statically without .lib Pin
Ted Ferenc26-Feb-03 12:21
Ted Ferenc26-Feb-03 12:21 
GeneralRe: Is it possible to link dll statically without .lib Pin
JohnnyG26-Feb-03 15:31
JohnnyG26-Feb-03 15:31 
GeneralRe: Is it possible to link dll statically without .lib Pin
Ted Ferenc26-Feb-03 21:31
Ted Ferenc26-Feb-03 21:31 
GeneralSolution found. Thanks to all! Pin
Valera24117627-Feb-03 6:54
Valera24117627-Feb-03 6:54 
GeneralRe: Solution found. Thanks to all! Pin
Ted Ferenc27-Feb-03 7:30
Ted Ferenc27-Feb-03 7: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.