Get make of Device

  • Thread starter Thread starter Peter B
  • Start date Start date
P

Peter B

Is there an easy and generic way of getting the make of a device? I.e. Dell,
Compaq/HP, Intermec etc...
 
I don't see any generic way provided by the OS to query that information.
If it exists, it would be Pocket PC-specific. Of course, if you have some
type of network card in every device, you can look at the Ethernet address,
the first three bytes of which indicate who made the card.

Paul T.
 
You can P/Invoke SystemParametersInfo() with parameter SPI_GETOEMINFO to
retrieve a string defined by each OEM to identify their device. As there is
no particular format for this string, you will have to try this function on
each type of device that you wish to check for and make a note of the
strings that get returned.

For an example in C++, see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppc2k/html/ppc_hpocket.asp.

Hope that helps,
Darren
 
Thanks!


Darren Beckley said:
You can P/Invoke SystemParametersInfo() with parameter SPI_GETOEMINFO to
retrieve a string defined by each OEM to identify their device. As there is
no particular format for this string, you will have to try this function on
each type of device that you wish to check for and make a note of the
strings that get returned.

For an example in C++, see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppc2k/html/ppc_hpocket.asp.

Hope that helps,
Darren
 
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;


}

}
 
Thanks a LOT!

In the meantime I discovered that in most cases the Vendor name is in
the registry under LOCAL_MACHINE\Platform.
 
Investigating it abit further I only got 1 out of 3 to display the make of
the device.

HKEY_LOCAL_MACHINE->Platform->Name

Device value
Intermec "Intermec 740"
Dell "Microsoft Windows CE Hardware Reference Platform"
iPAQ "Microsoft Windows CE Hardware Reference Platform"

/ Peter
 
Sorry if that "most cases" was misleading. At the office we use mostly
Symbol and Intermec and I only checked
several models of these two vendors.
 
Back
Top