Remove the EDIT menu that Liberty BASIC automatically adds to the menu bar when program contains a texteditor. Updated August 14, 2006
NoMainWin
Menu #main, "&File","E&xit",[quit]
Menu #main, "Edit"
Texteditor #main.t,10,10,200,200
Open "A Window" For Window As #main
#main "trapclose [quit]"
hMain=hWnd(#main)
hMainMenu=GetMenu(hMain)
hMainEdit=GetSubMenu(hMainMenu,1)
result=RemoveMenu(hMainMenu,hMainEdit)
Call DrawMenuBar hWnd(#main)
Wait
[quit]
Close #main:End
'functions:
Sub DrawMenuBar hWnd
CallDLL #user32, "DrawMenuBar",_
hWnd As ulong, r As boolean
End Sub
Function GetSubMenu(hMenuBar,nPos)
CallDLL #user32, "GetSubMenu",_
hMenuBar As ulong, nPos As long,_
GetSubMenu As ulong
End Function
Function GetMenu(hWnd)
CallDLL #user32, "GetMenu",hWnd As ulong,_
GetMenu As ulong
End Function
Function RemoveMenu(hMenu,hSubMenu)
CallDLL #user32, "RemoveMenu", hMenu As ulong,_
hSubMenu As ulong, _MF_BYCOMMAND As ulong,_
RemoveMenu As boolean
End Function