#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("&Файл")
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('Button', 10, 100, 70, 25)
GUISetState()
GUIRegisterMsg($WM_HELP, "WM_HELP")

While 1
	Switch GUIGetMsg()
		Case $iButton
			GUICtrlSetData($iData, 'Done')
		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::/html/functions/GUICtrlCreateButton.htm"')
		Case $iHelp
			If FileExists($sAutoIt_Path & '\AutoIt3.chm') Then Run('hh.exe "' & $sAutoIt_Path & '\AutoIt3.chm::/html/functions/GUICtrlCreateLabel.htm"')
		Case $iData
			ToolTip('Это надпись 2')
			AdlibRegister('_CloseToolTip', 2000)
	EndSwitch
EndFunc

Func _CloseToolTip()
	AdlibUnRegister('_CloseToolTip')
	ToolTip('')
EndFunc