you can get the mouse coordinates using GetCursorPos as shown
Finding the X and Y co-ordinates of the mouse pointer
http://216.26.168.92/mouse/tip65.htmlif that is not what you want, try to install a mouse hook, see discussions here:http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20105958.html
Finding the X and Y co-ordinates of the mouse pointer
http://216.26.168.92/mouse/tip65.htmlif that is not what you want, try to install a mouse hook, see discussions here:http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20105958.html
可能是我没说清楚,我想要得到的是鼠标指针,要在设备场景中用鼠标指针画出鼠标图案,不同的地方返回的鼠标指针是不同的,再顶哎
怎么还没人知道啊?或者这么说,谁知道如何在截获屏幕图片的时候连同鼠标一同截获?
其实你的目的就是要获取当前的鼠标句柄啊?没错啊??
用这个涵数获取句柄后,画出来的当然就是屏幕当前的鼠标样子了嘛,难道不是吗?
====================================================================
错!GetCursor只能获取当前进程的鼠标句柄
其他的进程不行好像没有其他方法所以我先前没有回答
Dim y, tid, hwnd As Long
hwnd = GetForegroundWindow()
tid = GetWindowThreadProcessId(hwnd, y)
If tid = 0 Then
getmousehandle = 0
Exit Function
End If
If tid <> GetCurrentThreadId() Then
y = AttachThreadInput(GetCurrentThreadId(), tid, True)
hwnd = GetCursor()
y = AttachThreadInput(GetCurrentThreadId(), tid, False)
End If
getmousehandle = hwnd
End Function
如果不行,我继续顶顶顶
通常,系统内的每个线程都有自己的输入队列。本函数(既“连接线程输入函数”)允许线程和进程共享输入队列。连接了线程后,输入焦点、窗口激活、鼠标捕获、键盘状态以及输入队列状态都会进入共享状态