找回密码
 加入
搜索
查看: 2577|回复: 5

[GUI管理] 【已解决】如何确定鼠标一定在指定的窗口(已激活的窗口)之中?在线等

  [复制链接]
发表于 2012-7-25 20:42:38 | 显示全部楼层 |阅读模式
本帖最后由 xowen 于 2012-8-7 22:19 编辑

例如,一个指定的窗口被激活,如何确定鼠标的指针一定在这个窗口之内(不包括窗口的边框,如图,确定出鼠标一定在红色的框中)?谢谢了,求高手解答,我试了对比x,y坐标,但感觉没达到要求。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2012-7-25 21:19:14 | 显示全部楼层
Opt('MouseCoordMode', 2)

HotKeySet("{ESC}", "_Quit")

While 1
        Sleep(10)
        $aPos = WinGetClientSize("[active]")
        If Not IsArray($aPos) Then ContinueLoop
        If MouseGetPos(0) > 0 And MouseGetPos(0) < $aPos[0] And _
                        MouseGetPos(1) > 0 And MouseGetPos(1) < $aPos[1] Then ToolTip('激活窗口内')
WEnd

Func _Quit()
        Exit
EndFunc   ;==>_Quit

评分

参与人数 1金钱 +10 收起 理由
xiehuahere + 10 Good

查看全部评分

发表于 2012-7-25 21:43:05 | 显示全部楼层
回复 2# afan


    估计楼主是没用opt
 楼主| 发表于 2012-7-25 22:16:42 | 显示全部楼层
谢谢了,确实没用opt
发表于 2012-7-26 12:51:22 | 显示全部楼层
OPT 起初我也不会用
发表于 2012-7-26 21:18:08 | 显示全部楼层
#include <Winapiex.au3>
Opt('MouseCoordMode', 2)
HotKeySet("{ESC}", "_Quit")

While 1
        Sleep(10)
        $rect = _WinAPI_GetClientRect(WinGetHandle("[active]"))
        $mPos = MouseGetPos()
        $point = _WinAPI_CreatePoint($mPos[0],$mPos[1])
        If _WinAPI_PtInRect($rect,$point) Then
                ToolTip('激活窗口客户区内')
        Else
                ToolTip('激活窗口客户区外')
        EndIf
WEnd

Func _Quit()
        Exit
EndFunc   ;==>_Quit
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-12 01:48 , Processed in 0.084058 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表