如何获取其它进程的鼠标头标(GetCursor只能获取本进程的光标指针)
来源:百度知道 编辑:UC知道 时间:2024/09/23 12:16:22
Private Declare Function GetCursor Lib "user32" () As Long
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Sub Command1_Click()
DrawIcon Picture1.hdc, 1, 1, GetCursor
End Sub
修改窗口代码如下
Private Declare Function GetCursor Lib "user32" () As Long
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function AttachThreadInput Lib "user32" (ByVal idAttach As Long, ByVal idAttachTo As Long, ByVal fAttach As Long) As Long
Private Sub Command1_Click()
Picture1.Cls
DrawIcon Picture1.hdc, 1, 1, MyGetCursor
End Sub
Private Function MyGetCursor() As Long
Dim hWindow As Long, dwThreadID As Long, dwCurrentThreadID As Long
Dim Pt As POINTAPI