Damir said:
Hi Folks
Is there a posibility to read Device Model with Compact Framework, for
exampe HP xxxx, or Qtek S100 or Metrologic or something like this?
I have to handle the scanner diffrent way for each device, and would like to
do it automaticly, without external settings.
You can get some information by P/Invoke'ing SystemParametersInfoW.
See:
https://blogs.msdn.com/netcfteam/archive/2006/09/15/756755.aspx
http://blogs.msdn.com/netcfteam/archive/2006/09/22/766343.aspx
Here's a simple example from a project I'm working on. No docs,
sorry, but I think it's pretty self-explanatory.
----Scott.
public class PInvoke
{
[DllImport("Coredll.dll", EntryPoint = "SystemParametersInfoW", CharSet = CharSet.Unicode)]
static extern int SystemParametersInfo4Strings(uint uiAction, uint uiParam, StringBuilder pvParam, uint fWinIni);
public enum SystemParametersInfoActions : uint
{
SPI_GETPLATFORMTYPE = 257, // this is used elsewhere for Smartphone/PocketPC detection
SPI_GETOEMINFO = 258,
}
public static string GetOemInfo(string onError)
{
StringBuilder oemInfo = new StringBuilder(50);
if (SystemParametersInfo4Strings((uint)SystemParametersInfoActions.SPI_GETOEMINFO,
(uint)oemInfo.Capacity, oemInfo, 0) == 0)
return onError;
return oemInfo.ToString();
}
public static string GetOemInfo()
{
string ret = GetOemInfo(null);
if (ret == null)
throw new Exception("Error getting OEM info.");
return ret;
}
public static string GetPlatformType(string onError)
{
StringBuilder platformType = new StringBuilder(50);
if (SystemParametersInfo4Strings((uint)SystemParametersInfoActions.SPI_GETPLATFORMTYPE,
(uint)platformType.Capacity, platformType, 0) == 0)
return onError;
return platformType.ToString();
}
public static string GetPlatformType()
{
string ret = GetPlatformType(null);
if (ret == null)
throw new Exception("Error getting platform info.");
return ret;
}
}