PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Call to know if device has touchscreen?

I was wondering if there was a call that could be used to see if the device my code was running on has a touchscreen.

I'd like to have 1 exe that can be used on either smartphones with no touchscreens or with. If no touchscreen is there, I'd show the lower buttons that correspond to the 2 menu keys on most smartphone apps...
otherwise hide them and let the user click on my menu buttons.
Devices with touchscreens should have registry entries for calibration, while other devices shouldn't (I assume). If a touchscreen driver is loaded, you can see if it is an active process in memory or even the registry.
You may just bring a message in the beginning: "If your device have a touchscreen tap anywhere, otherwise press any button" :).
Yes, asking the user would probably be the simplest and most reliable...

Although I did find a function that was supposed to report the number of mouse buttons available. On my desktop, it correctly reports 5, on the PDA it correctly reports 1, but on the smartphone it still says 1 instead of 0.
Well, you may probably try LoadLibrary(_T("touch.dll")) and analize return codes, but it doesn't seem to me as a nice solution.
jaguard wrote:Well, you may probably try LoadLibrary(_T("touch.dll")) and analize return codes, but it doesn't seem to me as a nice solution.
I think it is better to check presence and value of a "DriverName" key in "HKEY_LOCAL_MACHINE\Hardware\DeviceMap\Touch" (it should be "touch.dll", otherwize it would not work) and existence of the DLL. If everything is present - you have a touchscreen.
But you can also have a mouse (kbdmouse.dll, but it is on different key).