Is there a way to print a WCHAR variable with DrawFont?
I want to read the OEM Model name from a PocketPC and display it on screen with this standard PPC function but DrawFont only takes a char*:
WCHAR wszMachineName[128];
SystemParametersInfo(SPI_GETOEMINFO, sizeof(wszMachineName), &wszMachineName;, 0);
I recommend using the built in Edge function ClassEDevice::GetModelName. This uses the same API call and returns the value in a multibyte string (char[]).
If you want to handle unicode strings in the future, you can use the ClassEStd string conversion functions. Here is an example on how to convert between string types:
WCHAR wszText[] = L"test";
char szNewtext[256];
ClassEStd::StrCpy(szNewtext, wszText);
The docs say GetModelName only works on Symbian devices - is that not true?
Actually GetModelName() is supported, but GetModelID() isn't. This is something we need to clarify a bit more. Thanks for pointing that out.
You can call GetModelID() for Windows Mobile, but it returns the value 0. Also, the modelid parameter for GetModelName() isn't needed for Windows Mobile.
We recommend to use the following syntax for getting the device model name to make it work on all platforms:
char modelname[MAX_ESTR];
ClassEDevice::GetModelName(ClassEDevice::GetModelID(), modelname);
It would still be nice to have functions that would automatically use wide chars since I've tried porting some stuff over that use the TCHAR and equivalents of the string functions. It would save a lot of time not having to manually convert using ClassEStd::StrCpy and keep my code clean between the pocketPC and desktop builds.
Adding WCHAR support for the existing functions is planned for one of the upcoming Edge releases.