| 名称 | GetCursorPos2 获得鼠标坐标 |
|---|---|
| 功能 | 获得操作系统桌面中的鼠标坐标。功能与GetCursorPos完全相同,只是为了解决部分语言不支持参数传址的问题。使用Open打开设备后才可以使用它。 |
| 参数 | |
| 返回值 | 32位整型数。低16位是横坐标,高16位是纵坐标。 |
| vbs 例子 |
Function GetX(pos) GetX=CInt("&h" & Hex(pos And &h0000FFFF&)) End Function Function GetY(pos) GetY=CInt((pos And &hFFFF0000&)/&h10000&) End Function Dim DevId,pos DevId=wyhkm.SearchDevice(&h1234&,&hABCD&,0) If DevId=-1 Then MsgBox "未找到无涯键鼠盒子",4096 wscript.quit End If If Not wyhkm.Open(DevId,0) Then MsgBox "打开无涯键鼠盒子失败",4096 wscript.quit End If pos=wyhkm.GetCursorPos2() MsgBox "鼠标坐标:"&CStr(GetX(pos))&","&CStr(GetY(pos)),4096 wyhkm.Close |