Code: Select all
Sleep, 1000 ;; time-for-selectWindow
v := DllCall("GetMenu",uint,WinActive( "A" ))
DllCall("DestroyMenu",uint,v)
Msgbox % "Menu expected to be remove"
WinActivate
v:=DllCall("GetMenu",uint,WinActive( "A" ))
Msgbox % "still showing: " v
Code: Select all
Sleep, 1000 ;; time-for-selectWindow
v := DllCall("GetMenu",uint,WinActive( "A" ))
w := DllCall("GetMenuItemCount",uint,v)
Msgbox % w
(PS - I know the next code hide it, but I want to destroy it:)
Code: Select all
Sleep, 1000 ;; time-for-selectWindow
v := DllCall("GetMenu",uint,WinActive( "A" ))
Msgbox % "Hide Menu"
DllCall("SetMenu", uint, WinExist(""), uint, 0)
Msgbox % "Show Menu, using it hwnd: " v
DllCall("SetMenu", uint, WinExist(""), uint, v)
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getmenu
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-destroymenu
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getmenuitemcount
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setmenu