Hello forum, I´m trying to trap messages from diferent controls to add functionality.
I managed to get messages from buttons but I´m confused respect how to trap other controls.
Here is the code in case anyone could help me.
Thanks in advance.
I managed to get messages from buttons but I´m confused respect how to trap other controls.
Here is the code in case anyone could help me.
Thanks in advance.
[ autoit ]
#include #include #include #include #include #include Opt("GUIOnEventMode", 1) Global $Form1, $Label1, $Input1, $Label2, $Input2, $Label3, $Input3, $Edit1, $Button1, $Button2, $Checkbox1, $Radio1 Global $Gui = GUICreate("Basic GUI", 615, 362, 192, 124) GUISetOnEvent($GUI_EVENT_CLOSE, "Salir") $Label1 = GUICtrlCreateLabel("Label1", 24, 48, 36, 17) $Input1 = GUICtrlCreateInput("Input1", 80, 48, 161, 21) $Label2 = GUICtrlCreateLabel("Label2", 24, 96, 36, 17) $Input2 = GUICtrlCreateInput("Input2", 80, 88, 161, 21) $Label3 = GUICtrlCreateLabel("Label3", 24, 136, 36, 17) $Input3 = GUICtrlCreateInput("Input3", 80, 128, 161, 21) $Edit1 = GUICtrlCreateEdit("", 304, 48, 265, 113) GUICtrlSetData(-1, "Edit1") $Button1 = GUICtrlCreateButton("Button1", 32, 184, 121, 33) $Button2 = GUICtrlCreateButton("Button2", 192, 184, 121, 41) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 352, 184, 97, 25) $Radio1 = GUICtrlCreateRadio("Radio1", 488, 184, 73, 33) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While Sleep(100) WEnd Func Salir() GUIDelete() Exit EndFunc ;==>Salir Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Local Const $BCN_HOTITEMCHANGE = -1249 Local $tNMBHOTITEM = DllStructCreate("hwnd hWndFrom;int IDFrom;int Code;dword dwFlags", $lParam) Local $nNotifyCode = DllStructGetData($tNMBHOTITEM, "Code"), _ $nID = DllStructGetData($tNMBHOTITEM, "IDFrom"), _ $hCtrl = DllStructGetData($tNMBHOTITEM, "hWndFrom"), _ $dwFlags = DllStructGetData($tNMBHOTITEM, "dwFlags"), _ $sText = "" Switch $nNotifyCode Case $BCN_HOTITEMCHANGE ; message sent by a button Switch $nID Case $Button1 ConsoleWrite("Message from button 1" & _GUICtrlButton_GetText($hCtrl) & @CRLF) Case $Button2 ConsoleWrite("Message from button 1" & _GUICtrlButton_GetText($hCtrl) & @CRLF) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY