Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Mobile
Technical Articles
 Quick Tip: Which Pocket PC is My Ap...
 
Quick Tip: Which Pocket PC is My Application Running On?
 

There are several different Pocket PCs and now Pocket PC 2002 out there. If your application needs to detect what device it is running on, you can use the following lines of code.

Applies to:
   Microsoft Windows Powered Pocket PC 2000
   Microsoft Windows Powered Pocket PC 2002

WCHAR wszMachineName[128];
SystemParametersInfo(SPI_GETOEMINFO, sizeof(wszMachineName),
          &wszMachineName, 0);

The definition of "SPI_GETOEMINFO" is located in the "winuser.h" include file. The OEM that created your Pocket PC can freely define the string that will be returned in "wszMachineName." This is the reason why the strings look so different from one Pocket PC to another. Here are the return values for the Pocket PCs currently available:

Device Return Values
Casio E115 Pocket PC J580
Casio EM-500 Pocket PC J760
HP Jornada 540 HP, Jornada 540, 9357, USEnglish, SH3
HP Jornada 545 HP, Jornada 545, 9357, USEnglish, SH3
Compaq iPAQ HC3600 Compaq iPAQ H3600
Symbol PPT 2700 Series PPT2700 by Symbol

Here is a sample WinMain that implements the call:

int WINAPI WinMain( HINSTANCE hInstance,
                    HINSTANCE hPrevInstance,
                    LPTSTR    lpCmdLine,
                    int       nCmdShow)
 
{
   // TODO: Place code here.
   WCHAR wszMachineName[128];
   SystemParametersInfo(SPI_GETOEMINFO, sizeof(wszMachineName),
             &wszMachineName, 0);
   WCHAR tst[500];
   wsprintf(tst,L"<%s>",wszMachineName);
   MessageBox(NULL,tst,wszMachineName,MB_OK);
 
   return 0;
}
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker