获得窗口左上角和鼠标所在的位置脚本

获得窗口左上角和鼠标所在的位置! 

运行环境:分辨率:1360×768 色深:32位 操作系统:Windows XP 按键精灵版本:7.00.4148

@hapychina 2009/4/29

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

获得窗口左上角和鼠标所在的位置脚本》有0个想法

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注