R
Robert Diamond
Hi ppl, just a quick question...
I need to use "MultiByteToWideChar(stuff)" to convert a char[MAX_PATH] to
unicode, so that OleLoadPicturePath can get the image files i want, and load
it into a HBITMAP, etc... I'm having trouble when my char[MAX_PATH] has a
%
I need to use "MultiByteToWideChar(stuff)" to convert a char[MAX_PATH] to
unicode, so that OleLoadPicturePath can get the image files i want, and load
it into a HBITMAP, etc... I'm having trouble when my char[MAX_PATH] has a
%
Code:
, for example:
"C:\Image\my image.bmp" is translated to the unicode equivalent, without
problems
"C:\Image\my%20image.bmp" is translated to the unicode equivalent of
"C:\Image\my image.bmp"
So i want to send in a path string to MultiByteToWideChar(stuff) which might
have %[code] in it, and I want MultiByteToWideChar() to ignor the %[code],
in other words:
something() {
char sPath[MAX_PATH];
OLECHAR sUniPath[MAX_PATH + 1];
// This is the first (and working) string
strcpy(sPath, "C:\image file.bmp");
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, sPath, -1, sUniPath,
MAX_PATH);
// sUniPath is the unicode for "C:\image file.bmp"
}
something() {
char sPath[MAX_PATH];
OLECHAR sUniPath[MAX_PATH + 1];
// This is the second (and NOT working) string
strcpy(sPath, "C:\image%20file.bmp");
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, sPath, -1, sUniPath,
MAX_PATH);
// sUniPath is the unicode for "C:\image file.bmp"... erf... I want it
to be the unicode for "C:\image%20file.bmp"...
}
I've tried to read up at msdn on MultiByteToWideChar, but I couldn't find
the params to do this (or just can't read the docs as well as some of you
people ~.0 ). If any of you know what i'm doing wrong, or know of a
different call to convert to unicode, please give me the info ;) I've hurd
that MultiByteToWideChar is the subject of overflows, so maybe finding a
different call would be best. Thanks in advance ;)