views:

152

answers:

2

I am using Win32_PointingDevice class to detect mice connected to the system. I ran my device discovery script on a machine which has touch screen. The discovery shows up with 3 pointing devices, directly connected USB mouse, wireless mouse and touch screen. My question is how to distinguish between USB mouse with touch screen.

If Win32_PointingDevice class doesn't provide information then are there any other methods which I can use to get mouse and touch information.

This is extension to my previous question at http://stackoverflow.com/questions/1746689/wmi-class-for-wireless-mouse

+1  A: 

Win32_PointingDevice.PointingType?

Haven't tried it (no touch screen), but MSDN documentation for Win32_PointingDevice says that PointingType = 8 is used to indicate touch screen.

(However, my mouse shows up as "2" ("Unknown") instead of "3" ("Mouse") -- so it may depend on how thorough your touch screen driver writers were when they implemented their WMI properties...)

Daryn
A: 

Maybe you can use WH_MOUSE_LL / WH_MOUSE hook to get extra info by function GetMessageExtraInfo()

#define MI_WP_SIGNATURE 0xFF515700
#define SIGNATURE_MASK 0xFFFFFF00
#define IsPenEvent(dw) (((dw) & SIGNATURE_MASK) == MI_WP_SIGNATURE)
#define IsTouchEvent(dw) (((dw) & 0x80) == 0x80)

if(IsPenEvent(GetMessageExtraInfo()) && IsTOuchEvent(GetMessageExtraInfo())) {
// do somthing
}
Vince