找回密码
 加入
搜索
查看: 49|回复: 3

[AU3基础] 请问一下msgbox的帮助按钮的设置问题

[复制链接]
发表于 昨天 09:21 | 显示全部楼层 |阅读模式
A大,请问一下,msgbox中16384 添加一个"帮助"按钮. 当用户点击"帮助"按钮或按 F1 键时, 系统向所有者发送 WM_HELP 消息. 这个帮助按钮给了任务的命令都无法执行请问要怎么写,麻烦帮助一下,谢谢。
我是写成 $a = msgbox(16384,'1','111')  if $a= 16384 then   后面跟命令无法执行,但是其它的是,否等等都是可以执行的,唯 独这个帮助不知道怎么使用,
发表于 昨天 13:18 | 显示全部楼层
没用过这个参数……
发表于 昨天 14:33 | 显示全部楼层
WM_HELP 消息应该是需要你写的吧,详细你看看 WM_HELP这个函数。下面是这个函数的例子,不过我看不懂。。。
#include <WindowsConstants.au3>

Global $k = 0
$sAutoIt_Path = RegRead("HKLM\SOFTWARE\AutoIt v3\AutoIt", "InstallDir")

$hGui = GUICreate("WM_HELP", 440, 270, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION), $WS_EX_CONTEXTHELP)
$iFileMenu = GUICtrlCreateMenu("文件 &F")
GUICtrlCreateMenuItem("打开", $iFileMenu)
GUICtrlCreateMenuItem("保存...", $iFileMenu)
$iHelp = GUICtrlCreateLabel('文本 1.', 25, 25, 75, 17)
$iData = GUICtrlCreateLabel('文本 2', 25, 65, 75, 17)
$iInfo = GUICtrlCreateLabel('', 100, 10, 330, 100)
$iButton = GUICtrlCreateButton('按钮', 10, 100, 70, 25)
GUISetState()
GUIRegisterMsg($WM_HELP, "WM_HELP")

While 1
    Switch GUIGetMsg()
        Case $iButton
            GUICtrlSetData($iData, '完成')
        Case -3
            Exit
    EndSwitch
WEnd

Func WM_HELP($hWnd, $Msg, $wParam, $lParam)
    Local $ContextID, $ContextType, $CtrlID, $ItemHandle, $tInfo, $X, $Y
    Local Const $tagHELPINFO = "uint Size;int ContextType;int CtrlID;handle ItemHandle;dword ContextID;int PointX;int PointY"
    $tInfo = DllStructCreate($tagHELPINFO, $lParam)
    $ContextType = DllStructGetData($tInfo, "ContextType")
    $CtrlID = DllStructGetData($tInfo, "CtrlID")
    $ItemHandle = HWnd(DllStructGetData($tInfo, "ItemHandle"))
    $ContextID = DllStructGetData($tInfo, "ContextID")
    $X = DllStructGetData($tInfo, "PointX")
    $Y = DllStructGetData($tInfo, "PointY")
    GUICtrlSetData($iInfo, _
            '类型 = ' & $ContextType & @LF & _
            '标识符 = ' & $CtrlID & @LF & _
            '句柄 = ' & $ItemHandle & @LF & _
            'ID = ' & $ContextID & @LF & _
            'X = ' & $X & @LF & _
            'Y = ' & $Y)
    $k += 1
    WinSetTitle($hGui, '', '消息发生次数: ' & $k)
    Switch $CtrlID
        Case $iButton
            If FileExists($sAutoIt_Path & '\AutoIt3.chm') Then Run('hh.exe "' & $sAutoIt_Path & '\AutoIt3.chm../functions/GUICtrlCreateButton.htm"')
        Case $iHelp
            If FileExists($sAutoIt_Path & '\AutoIt3.chm') Then Run('hh.exe "' & $sAutoIt_Path & '\AutoIt3.chm../functions/GUICtrlCreateLabel.htm"')
        Case $iData
            ToolTip('文字 2')
            AdlibRegister('_CloseToolTip', 2000)
    EndSwitch
EndFunc

Func _CloseToolTip()
    AdlibUnRegister('_CloseToolTip')
    ToolTip('')
EndFunc
 楼主| 发表于 2 小时前 | 显示全部楼层
zhaoceshi 发表于 2024-10-24 14:33
WM_HELP 消息应该是需要你写的吧,详细你看看 WM_HELP这个函数。下面是这个函数的例子,不过我看不懂。。 ...

谢谢,是我看错了,帮助中,是没有这个返回值的,然后去外面的官网论坛中看了一下,好像这个帮助,只有在GUI下,才可以被有提示出来,至于点击,外网中英文功底不行,没有找到,你的这个我去试试,
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-10-25 11:19 , Processed in 0.082658 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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