找回密码
 加入
搜索
查看: 2666|回复: 6

[AU3基础] 获得当前鼠标指向的句柄

  [复制链接]
发表于 2010-11-18 18:41:56 | 显示全部楼层 |阅读模式
hwnd=Plugin.Window.MousePoint()

这是按键精灵按下启动热键时就自动获取当前鼠标指向的句柄,在AU3里不知道有没什么简单方法实现这个功能。
发表于 2010-11-18 19:58:28 | 显示全部楼层
本帖最后由 xyold1 于 2010-11-18 20:00 编辑

看错了哦,没留意鼠标的句柄

下面是鼠标的位置
MouseGetPos
获取当前鼠标的坐标位置.
MouseGetPos ( [维数] )
 楼主| 发表于 2010-11-18 20:09:47 | 显示全部楼层
得到鼠标坐标了怎样获得句柄呢。
发表于 2010-11-18 20:16:07 | 显示全部楼层
本帖最后由 xyold1 于 2010-11-18 20:18 编辑

一般来说,win下有多个窗口,所以用窗口来区别,而鼠标指针就一个吧,要鼠标的句柄有什么呢
发表于 2010-11-18 20:35:16 | 显示全部楼层
#include <WinAPI.au3>
_WinAPI_WindowFromPoint() ; - -|||
 楼主| 发表于 2010-11-18 21:06:54 | 显示全部楼层
一般来说,win下有多个窗口,所以用窗口来区别,而鼠标指针就一个吧,要鼠标的句柄有什么呢
xyold1 发表于 2010-11-18 20:16


游戏多开的时候,窗口全一样,不会判断。
发表于 2010-11-18 23:39:32 | 显示全部楼层
下面的代码是官网上搜的,不知道是不是楼主要的效果
#include <WinAPI.au3>

Global $Struct = DllStructCreate($tagPoint)

_Main()

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

    While 1
        Sleep(100)
        ToolTip("")
        Pos()
        $hwnd = _WinAPI_WindowFromPoint($Struct)
        ToolTip($hwnd)
    WEnd
EndFunc   ;==>_Main

Func Pos()
    DllStructSetData($Struct, "x", MouseGetPos(0))
    DllStructSetData($Struct, "y", MouseGetPos(1))
EndFunc   ;==>Pos

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

本版积分规则

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

GMT+8, 2024-5-18 09:17 , Processed in 0.077273 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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