English 中文(简体)
WMI: How to differentiate between Wireless mouse and touch screen
原标题:

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 WMI Class for wireless mouse

问题回答

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...)

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
}




相关问题
Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Programmatically detect Windows cluster configuration?

Does anyone know how to programatically detect that a Windows server is part of a cluster? Further, is it possible to detect that the server is the active or passive node? [Edit] And detect it from ...

get file icon for Outlook appointment (.msg)

I ve read Get File Icon used by Shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great. However, Outlook uses ".msg" ...

Identifying idle state on a windows machine

I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn t mean the ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签