I’ve had a few developers asking recently about how to detect device resolution at install time from inside a setup.dll. It turns out that this may not behave as you expect due to some backwards compatibility logic. There is a sample in the SDK that shows how to do this, but it’s easy to miss. Check out the following sample that demonstrates how to do this…
“…This code sample is named ResDLL. It demonstrates how to create a CAB install with the smarts to tailor the installation to the target device’s screen resolution.
When you develop applications for the newer high-resolution Windows Mobile devices with 192 DPI resolution displays, you might consider how to include the high-resolution versions of bitmaps and resources in your executable. The simplest solution is to just include them in the executable along with the low-resolution version of the bitmaps and resources — but this approach ends up wasting precious storage space. Since mobile devices have screens with a resolution that never changes, resources targeted at screen resolutions other that the one used on the mobile device, are neither needed nor used.
A better approach is to separate the application resources into resolution-specific DLLs — one targeted at 96 DPI devices, and another targeted at 192 DPI devices. This allows the mobile device to become an interactive part of the installation process, enabling it to dictate which specific resources it requires.”