Goto start Rem Ting While 1 WaitKey K //检测用户按键 If K = 27 //按下ESC键时跳到---->脚本执行的地方! Goto start EndIf EndWhile Rem start MessageBox "按空格获得窗口和鼠标的位置!"&vbcr&"按ESC键暂停!" While 1 WaitKey K If K = 32 //按下空格键的时->候执行脚本! // //下面这句是得到鼠标指向的窗口句柄 Plugin Hwnd = Window.MousePoint() //下面这句是得到窗口句柄的边框大小(包括标题栏) Plugin Rect = Window.GetWindowRect(Hwnd) R = Split(Rect,"|") x=R(0) y=R(1) x2 = R(2) y2 = R(3) VBSCall GetCursorPos(nowx,nowy) px = nowx-x py = nowy-y MessageBox "窗口左上角的位置:"& x & "." & y & vbcr &"窗口大小:" & x2-x &"."& y2-y & vbcr & "鼠标相对窗口左上角的位置:" & px & "." & py UnlockMouse EndWhile ElseIf K = 27 MessageBox "脚本已停止,按ESC键重新开始!" Goto Ting //按下ESC键时->暂停! EndIf EndWhile