Valnurat Posted February 28, 2020 Posted February 28, 2020 I just want to know why there's "= 1000" in 5th line for $e_idOpen and not for $e_idSave and $e_idInfo? expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiMenu.au3> #include <WinAPIError.au3> #include <WindowsConstants.au3> Global Enum $e_idOpen = 1000, $e_idSave, $e_idInfo Example() Func Example() ; Create GUI GUICreate("Menu", 400, 300) GUISetState(@SW_SHOW) ; Register message handlers GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example ; Handle WM_COMMAND messages Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch $wParam Case $e_idOpen _WinAPI_ShowMsg("Open") Case $e_idSave _WinAPI_ShowMsg("Save") Case $e_idInfo _WinAPI_ShowMsg("Info") EndSwitch EndFunc ;==>WM_COMMAND ; Handle WM_CONTEXTMENU messages Func WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Local $hMenu $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $e_idOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $e_idSave) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $e_idInfo) _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) _GUICtrlMenu_DestroyMenu($hMenu) Return True EndFunc ;==>WM_CONTEXTMENU Yours sincerely Kenneth.
Nine Posted February 28, 2020 Posted February 28, 2020 Look at https://www.autoitscript.com/autoit3/docs/keywords/Enum.htm The script starts the enum at 1000. So $e_idOpen = 1000, $e_idSave = 1001, $e_idInfo = 1002 Just a way to simplify enumeration. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now