Get rid of W->A calls
Dimitrie O. Paun
dimi at intelliware.ca
Fri Sep 5 12:38:38 CDT 2003
On Fri, 5 Sep 2003, hatky wrote:
> So should I make it uCommand as in msdn or leave it
> wcommand?
I'd change both to uCommand as per msdn.
> > WCHAR clsName[] = { 'M', 'S', '_', 'W', 'I',
> > 'N', 'H', 'E', 'L', 'P', 0 };
> > hDest = FindWindowW(clsName, NULL);
Don't forget Robert's advice, use:
static const WCHAR clsName[] ...
> Ok, I get this but why don't we support Unicode
> literals? seems like it makes the code a mess and
> there will be another task to clean that up
> sometime...
Yes, it is inconvenient, but some Unix compilers
don't support 16-bit Unicode literals, so we're stuck
with that for the moment.
> And the code goes like this:?
> INT len;
> LPSTR file;
^
LPWSTR
> BOOL ret = FALSE;
>
> if (!lphelpFile) return WinHelpW( hWnd, NULL,
> command, dwData );
>
> len = MultiByteToWideChar( CP_ACP, 0, helpFile,
> -1, NULL, 0, NULL, NULL );
> if ((file = HeapAlloc( GetProcessHeap(), 0, len
> )))
> {
> MultiByteToWideChar( CP_ACP, 0, helpFile, -1,
> file, len, NULL, NULL );
> ret = WinHelpW( hWnd, file, command, dwData );
> HeapFree( GetProcessHeap(), 0, file );
> }
> return ret;
>
> Wait, if I change lpHelpFile to Unicode then I should
> change also:
>
> +#include "wine/unicode.h"
This is good.
> or should it be
> +#include <unicode.h>?
This will not work.
> - nlen = strlen(lpHelpFile) + 1;
> + nlen = strlenW(lpHelpFile) + 1;
Yes...
> - strcpy(((char*)lpwh) + sizeof(WINHELP),
> lpHelpFile);
> + strcpyW(((char*)lpwh) + sizeof(WINHELP),
> lpHelpFile);
Yes.
> and I assume
> if (lpHelpFile)
> is still ok, right?
Right.
--
Dimi.
More information about the wine-devel
mailing list