Hat jemand eine Idee, wie ich ein Menu Item, welches ich mit _GUICtrlMenu_RemoveMenu() gelöscht habe, wieder zurückholen kann mit allen Untermenüs?
Beispiel: in Notepad wird der Menueintrag "Hilfe / Help" gelöscht.
AutoIt
#include <GuiMenu.au3>
Example()
Func Example()
Local $hWnd, $hMain
; Open Notepad
Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hMain = ' & $hMain & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
$iD = _GUICtrlMenu_GetItemID ( $hMain, 4)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iD = ' & $iD & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
$hMenu_save = _GUICtrlMenu_GetItemSubMenu($hMain, 4)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hMenu_save = ' & $hMenu_save & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
Sleep(1000)
; Remove Help menu
_GUICtrlMenu_RemoveMenu($hMain, 4)
Sleep(2000)
;~ ConsoleWrite(_GUICtrlMenu_SetMenu($hMain, $hMenu_save) & @CRLF)
;~ ConsoleWrite(_GUICtrlMenu_SetItemSubMenu ( $hMain, 4, $hMenu_save) & @CRLF)
;~ _GUICtrlMenu_InsertMenuItem ( $hMain, 4, "Help", $iD, $hMain)
_GUICtrlMenu_DrawMenuBar($hMain)
EndFunc ;==>Example
Alles anzeigen
Zitat
Deletes a menu item or detaches a submenu from the specified menu. If the menu item opens a drop-down menu or submenu, RemoveMenu does not destroy the menu or its handle, allowing the menu to be reused. Before this function is called, the GetSubMenu function should retrieve a handle to the drop-down menu or submenu.
Danke.