internal const int SPI_GETPLATFORMTYPE = 257;
[DllImport("coredll.dll")]
internal static extern int SystemParametersInfo (
int uiAction,
int uiParam,
string pvParam,
int fWinIni );
public enum Platform
{
PocketPC2000,
PocketPC2002,
PocketPC2003,
Unknown
}
public Platform GetPlatform()
{
string szPlatform = " ";
string strPlatform = "";
//Get OSVersion
System.OperatingSystem osVersion = Environment.OSVersion;
// Get Platform
int ret = SystemParametersInfo(SPI_GETPLATFORMTYPE, szPlatform.Length ,
szPlatform, 0);
if (ret != 0)
{
strPlatform = szPlatform.Substring(0, szPlatform.IndexOf('\0'));
}
if (osVersion.Version.Major == 3) //PPC2000 or PPC2002
{
if (strPlatform == "PocketPC")
return Platform.PocketPC2002;
else
return Platform.PocketPC2000;
}
else if (osVersion.Version.Major == 4) //WinCE.NET
{
if (strPlatform == "PocketPC")
return Platform.PocketPC2003;
else
return Platform.Unknown;
}
return Platform.Unknown;
}