1.
Systemparametersinfo can only obtain the platform (SP, PPC) and mobile phone model.
2.
Getversionex can only obtain the master version, secondary version (for CE version), and build version, but cannot obtain the Windows Mobile version.
(Windows Mobile 6.1 or Windows Mobile 6.5)
3. Obtain the operating system version in two ways:
A:
Kerneliocontrol (ioctl_processor_information ,)...
However, pkfuncs. h and toolhelp. h are required. Download Windows CE 5.0 or auk (not free ).
B. Another method:
# Define pocketpcv1 1
# Define smartphonev1 2
# Define pocketpcv2 3
# Define smartphonev2 4
Int mydevicetype ()
{
Tchar szplatform [max_string_buffer];
Int idevicetype = 0;
Osversioninfo osver;
Getversionex (& osver );
If (osver. dwmajorversion = 3)
{
If (systemparametersinfo (spi_getplatformtype, sizeof (szplatform), szplatform, 0 )! = 0)
{
If (lstrcmp (szplatform, text ("pocketpc") = 0)
{
Idevicetype = pocketpcv1; // runs on Pocket PC 2000 and 2002
}
Else if (lstrcmp (szplatform, text ("Smartphone") = 0)
{
Idevicetype = smartphonev1; // runs on Smartphone 2002
}
}
Else
{
If (getlasterror () = error_access_denied) // (5)
{
Idevicetype = smartphonev1; // is a smartphone:
// Smartphone creates an Access Denied error on
// Systemparametersinfo ()
}
}
}
Else
{
If (osver. dwmajorversion = 4)
{
If (systemparametersinfo (spi_getplatformtype, sizeof (szplatform), szplatform, 0 )! = 0)
{
If (lstrcmp (szplatform, text ("pocketpc") = 0)
{
Idevicetype = pocketpcv2; // runs on Pocket PC 2003
}
Else if (lstrcmp (szplatform, text ("Smartphone") = 0)
{
Idevicetype = smartphonev2; // runs on Smartphone 2003
}
}
Else
{
If (getlasterror () = error_access_denied) // (5)
{
Idevicetype = smartphonev2; // is a smartphone:
// Smartphone creates an Access Denied error on
// Systemparametersinfo ()
}
}
}
}
Return idevicetype;
}
Version Number OS version
3.0.9348 Pocket PC 2000
3.0.11171 Pocket PC 2002
4.20.xxxx Windows Mobile 2003
4.21.xxxx Windows Mobile 2003 se
5.1.342 Windows Mobile 5.0
5.2.20771 Windows Mobile 6.1
5.2.21869 Windows Mobile 6.5