Post by Jean#define UNICODE
#define _UNICODE
Stop, this doesn't work. These are evaluated in a few headers. Once these
headers are included, and they are at this point, these macros don't have
any further effect. Define them on the commandline or in a central header
included first by every file of your project. Otherwise, the chance of
having those inconsistent for different parts of your code is just too big.
If you're using MSVC, set the charset to "Unicode" in the "general" tab of
the project's settings. In any case, these only affect what TCHAR is, but
you are (almost) not using any TCHAR functions but the explicit *W or *A
versions.
Post by Jeanhh = (HANDLE)FindFirstFileW(wrep, &wfind);
if(hh == (HANDLE)0xff) return -1;
Two big nonos here:
1. Don't cast the returnvalue of FFF, use the correct type on the left side
instead.
2. The value it returns in case of errors is documented, use that macro
instead. I think it's INVALID_HANDLE_VALUE, but it could also be NULL.
Read the documentation at http://msdn.microsoft.com and/or install a plugin
for Firofox that looks up such functions there.
Post by Jeanif(wfind.dwFileAttributes & _A_SUBDIR) {
You generally never need anything starting like _THIS, i.e. underscore
followed by an uppercase letter. Again, read the documentation for the file
attributes, the constants are documented there.
Post by Jeansz = WideCharToMultiByte(CP_UTF8, 0, wfind.cFileName, -1, (LPSTR)NULL, 0,
NULL, NULL);
ansi = HeapAlloc(GetProcessHeap(), 0, sz+1);
ret = WideCharToMultiByte(CP_UTF8, 0, wfind.cFileName, -1, (LPSTR)ansi,
sz+1, NULL, NULL);
MessageBox(NULL,ansi,"",MB_OK);
How about a straightforward "MessageBoxW(NULL, wfind.cFileName, ...)"
instead? This will work.
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932