Monday, March 6, 2006
Determine Device Type At Runtime
Posted by Jon Westfall in "DEVELOPER" @ 05:00 AM
"There are times when it is useful for an application to know on what type of device it is running. An application may wish to modify it's user interface depending on device type (suppress button controls on SmartPhone devices, for example), or may be part of a test harness and have a need to log the type of device on which testing was performed. On Win32 platforms, including Windows CE, the function SystemParametersInfo provides a mechanism to get and set system-wide parameters on a device. The data returned by SystemParametersInfo (via the pvParam argument) can vary in type. Depending on the system parameter you request, the function can return a string, an integer, a structure, etc. This makes it a difficult function to call from managed code. We can make it using SystemParametersInfo easier by writing type safe wrappers for the specific system parameters of interest. Today's discussion will do just that for SPI_GETPLATFORMTYPE."
Now that it is quite conceivable for developers to have one codebase for their Windows Mobile project (instead of a dedicated PPC and Smartphone base), this handy bit of code may be useful in configuring your device at runtime for optimal experience on whatever device its running on.
Now that it is quite conceivable for developers to have one codebase for their Windows Mobile project (instead of a dedicated PPC and Smartphone base), this handy bit of code may be useful in configuring your device at runtime for optimal experience on whatever device its running on.