mr.underperson Posted May 29, 2006 Posted May 29, 2006 (edited) I know, it's probably really simple, but I've searched and searched and nothing's coming up anywhere! I just want to put a few items in the application menu, you know, the one in the top-left of all windows. How to do it? -mu Edited May 29, 2006 by mr.underperson
JoshDB Posted May 29, 2006 Posted May 29, 2006 (edited) Search for Holger's Menu Magic (I think that's the name of the topic /:)EDIT: http://www.autoitscript.com/forum/index.ph...wtopic=9955&hl= Edited May 29, 2006 by JoshDB Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
mr.underperson Posted May 29, 2006 Author Posted May 29, 2006 hmm, no, I think that's just for the regular menus. pretty, though. -mu
JoshDB Posted May 29, 2006 Posted May 29, 2006 Could you post a screenshot of what you mean? Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
marfdaman Posted May 29, 2006 Posted May 29, 2006 I believe he means the menu that shows up when you click the icon on the titlebar of a window or when you rightclick the titlebar. Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mr.underperson Posted May 29, 2006 Author Posted May 29, 2006 Yes! Sometimes it's called the "system menu"...http://media2.pugetsoundsoftware.com/ask-l.../i/cmdpaste.pnghttp://www.martinutils.com/screenshot.jpg-mu
Holger Posted May 30, 2006 Posted May 30, 2006 (edited) Small sample: expandcollapse popup#include <GUIConstants.au3> Global Const $MF_BYPOSITION = 0x00000400 Global Const $MF_SEPARATOR = 0x00000800 Global Const $MF_CHECKED = 0x00000008 Global Const $MF_POPUP = 0x00000010 Global Const $WM_SYSCOMMAND = 0x0112 Dim $nTPChecked = 0 Dim $hGUI = GUICreate("Test") GUISetState() GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") $nItem1 = CreateSystemMenuItem("Info about this...", -1, FALSE, 0) CreateSystemMenuItem("", -1, FALSE, 1) CreateSystemMenuItem("") $hTPMenu = CreateSystemMenuItem("Transparency", -1, TRUE) Dim $arTransItems[10] For $i = 0 To 9 $arTransItems[$i] = CreateSystemMenuItem($i * 10 & "%", $hTPMenu) If $i = 0 Then $nTPChecked = $arTransItems[$i] CheckMenuItem($hTPMenu, $nTPChecked, $MF_CHECKED) EndIf Next While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Exit ; ******** Functions ******** Func GetSystemMenu($hWnd, $bRevert) Local $hMenu = DllCall("user32.dll", "hwnd", "GetSystemMenu", _ "hwnd", $hWnd, _ "int", $bRevert) Return $hMenu[0] EndFunc Func InsertMenu($hMenu, $nPosition, $nFlags, $nIDNewItem, $lpNewItem) Local $nResult = DllCall("user32.dll", "int", "InsertMenu", _ "hwnd", $hMenu, _ "int", $nPosition, _ "int", $nFlags, _ "int", $nIDNewItem, _ "str", $lpNewItem) Return $nResult[0] EndFunc Func CreatePopupMenu() Local $hMenu = DllCall("user32.dll", "hwnd", "CreatePopupMenu") Return $hMenu[0] EndFunc Func CheckMenuItem($hMenu, $nID, $nFlags) DllCall("user32.dll", "int", "CheckMenuItem", _ "hwnd", $hMenu, _ "int", $nID, _ "int", $nFlags) EndFunc Func CreateSystemMenuItem($sText, $hMenu = -1, $bIsPopup = FALSE, $nPos = 0xFFFFFFFF); 0xFFFFFFFF means "insert at the end" If $hMenu = -1 Then $hMenu = GetSystemMenu($hGUI, 0) Local $nID = GUICtrlCreateDummy() Local $nFlags = 0 If $sText = "" Then $nFlags = $MF_SEPARATOR ElseIf $bIsPopup Then $nID = CreatePopupMenu() $nFlags = $MF_POPUP EndIf $nFlags = BitOr($MF_BYPOSITION, $nFlags) $nResult = InsertMenu($hMenu, $nPos, $nFlags, $nID, $sText) Return $nID EndFunc Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) $nID = BitAnd($wParam, 0x0000FFFF) Switch $nID Case $arTransItems[0] To $arTransItems[9] SetTransparency($nID) Case $nItem1 Msgbox(0, "Info", "SystemMenu sample.") EndSwitch EndFunc Func SetTransparency($nID) For $i = 0 To 9 If $arTransItems[$i] = $nID Then ExitLoop Next WinSetTrans($hGUI, "", 255 * (100 - $i * 10) / 100) If $nTPChecked <> $nID Then CheckMenuItem($hTPMenu, $nTPChecked, 0) CheckMenuItem($hTPMenu, $nID, $MF_CHECKED) $nTPChecked = $nID EndFunc Edited May 30, 2006 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
mr.underperson Posted May 30, 2006 Author Posted May 30, 2006 (edited) Excellent! Many thanks! Any chance of some buit-in commands in future releases? -mu Edited May 30, 2006 by mr.underperson
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