Page 1 of 1

DrawFont for WCHAR

PostPosted: Mar 23, 2006 @ 1:38am
by Jeffer
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);

PostPosted: Mar 23, 2006 @ 9:52am
by edge
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);

PostPosted: Mar 23, 2006 @ 5:25pm
by Jeffer
The docs say GetModelName only works on Symbian devices - is that not true?

PostPosted: Mar 23, 2006 @ 8:47pm
by edge
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);

PostPosted: Apr 20, 2006 @ 6:14pm
by fast_rx

PostPosted: Apr 21, 2006 @ 8:28am
by edge