The following class contains two functions to retrive the Platform and
OEMInfo string. The OEMInfo string usually contains the make of the device.
Put it in a code editor because the formatting is probably screwed...
public class MyWinAPI
{
private MyWinAPI()
{
//
// TODO: Add constructor logic here
//
}
internal const int SPI_GETPLATFORMTYPE = 257;
internal const int SPI_GETOEMINFO = 258;
[DllImport("coredll.dll")]
internal static extern int SystemParametersInfo (
int uiAction,
int uiParam,
string pvParam,
int fWinIni );
public enum Platform
{
PocketPC2000,
PocketPC2002,
PocketPC2003,
Unknown
}
public static 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;
}
public static string GetOEMInfo()
{
string szOEMInfo = " ";
string strOEMInfo = "";
// Get OEM Info
int ret = SystemParametersInfo(SPI_GETOEMINFO, szOEMInfo.Length , szOEMInfo,
0);
if (ret != 0)
{
strOEMInfo = szOEMInfo.Substring(0, szOEMInfo.IndexOf('\0'));
}
return strOEMInfo;
}
}