I was including the wx/wx.h headers to bring in a pre-built binary wxWidgets-3.0.2 from MSYS2/mingw32.
I got unicode-related errors from wx/msw/winundef.h:
~~~~
C:/msys32/mingw32/include/wx-3.0/wx/msw/winundef.h: In function 'HWND__* CreateDialog(HINSTANCE, LPCTSTR, HWND, DLGPROC)':
C:/msys32/mingw32/include/wx-3.0/wx/msw/winundef.h:38:20: error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateDialogParamW(HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM)'
return CreateDialogW(hInstance, pTemplate, hwndParent, pDlgProc);
^
~~~~
So I don't know why, when its _UNICODE, LPCTSTR is not already equivalent to LPCWSTR - I'm too newbie to do more than wonder - I suppose its just too hard to wedge into the typedef-ing scheme. Other than semantic difficulties, though,
they are the same, right? So when I change this line to
return CreateDialogW (hinstance, (LPCWSTR) pTemplate, hwndParent, rDlgProc),
because CreateDialogW is defined with LPCWSTR declarations,
I am simply by-passing a computer's misunderstanding. Is that correct? it compiles, anyway.
winundef has a few more snags like that, as well as a block of correctly posed re-defined macros:
~~~~~~~~~
#ifdef fcn
#undef (fcn)
#ifdef _UNICODE
fcn( blah, blah, LPCWSTR x)
return fcnW( x)
#else
fcn( blah, blah, LPCSTR x)
return fcnA(x)
#endif
#endif
~~~~~~~~
e.g.
~~~~~~
// FindWindow
#ifdef FindWindow
#undef FindWindow
#ifdef _UNICODE
inline HWND FindWindow(LPCWSTR classname, LPCWSTR windowname)
{
return FindWindowW(classname, windowname);
}
#else
inline HWND FindWindow(LPCSTR classname, LPCSTR windowname)
{
return FindWindowA(classname, windowname);
}
#endif
#endif
~~~~~~~~
Is what I did equivalent? also, why hasn't this already been done?