#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