Zedna Posted December 20, 2008 Share Posted December 20, 2008 (edited) Used main functions: _GUICtrlMenu_GetSystemMenu _GUICtrlMenu_InsertMenu _GUICtrlMenu_AppendMenu expandcollapse popup#include <GuiMenu.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Global $hGUI, $hSysMenu, $iCount Global Enum $idOptions = 1000, $idAbout $hGUI = GUICreate("System Menu", 400, 300) $hSysMenu = _GUICtrlMenu_GetSystemMenu($hGUI) $iCount = _GUICtrlMenu_GetItemCount($hSysMenu) ; insert items before end _GUICtrlMenu_InsertMenu ($hSysMenu, $iCount - 1, BitOr($MF_BYPOSITION, $MF_STRING), $idOptions, "&Options") _GUICtrlMenu_InsertMenu ($hSysMenu, $iCount, BitOr($MF_BYPOSITION, $MF_SEPARATOR), 0, "") ; append items after end _GUICtrlMenu_AppendMenu ($hSysMenu, $MF_SEPARATOR, 0, "") _GUICtrlMenu_AppendMenu ($hSysMenu, $MF_STRING, $idAbout, "&About") GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func Options() MsgBox(0, "Options","Options clicked") EndFunc Func About() MsgBox(0, "About","About clicked") EndFunc Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) Local $iId = BitAnd($wParam, 0xFFFF) Select Case $iId = $idOptions Options() Case $iId = $idAbout About() EndSelect EndFunc Func _GUICtrlMenu_InsertMenu($hMenu, $iPosition, $iFlags, $iNewItem, $pNewItem) Local $aResult If BitAND($iFlags, $MF_BITMAP) = 0 Then $aResult = DllCall("User32.dll", "int", "InsertMenu", "hwnd", $hMenu, "int", $iPosition, "int", $iFlags, "int", $iNewItem, "str", $pNewItem) Else $aResult = DllCall("User32.dll", "int", "InsertMenu", "hwnd", $hMenu, "int", $iPosition, "int", $iFlags, "int", $iNewItem, "int", $pNewItem) EndIf If @error Then Return False _GUICtrlMenu_DrawMenuBarEx($hMenu) Return $aResult[0] <> 0 EndFunc ;==>_GUICtrlMenu_InsertMenu Edited December 20, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
rambo3889 Posted December 20, 2008 Share Posted December 20, 2008 Nice work Zedna!!! I've always wondered if it was possible to add menu function to the system menu My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youre the best in town Fight! Link to comment Share on other sites More sharing options...
Zedna Posted December 20, 2008 Author Share Posted December 20, 2008 Nice work Zedna!!! I've always wondered if it was possible to add menu function to the system menu Thanks.I have been using it in many of my projects for a long time. I have sent _GUICtrlMenu_InsertMenu() UDF proposition to standard inlude files unfortunately it wasn't accepted. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
ProgAndy Posted December 20, 2008 Share Posted December 20, 2008 There is already a function to do that: _GUICtrlMenu_InsertMenuItem (but less options) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Zedna Posted December 20, 2008 Author Share Posted December 20, 2008 There is already a function to do that: _GUICtrlMenu_InsertMenuItem (but less options)I know about that.I have just created _GUICtrlMenu_InsertMenu() on the same basis as existing _GUICtrlMenu_AppendMenu() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
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