AppendMenu or InsertMenu, whichever you prefer really.
#constant MF_STRING 0
#constant MF_POPUP 16
#constant ID_EXIT 0xF0
#constant ID_OPEN 0xF1
Disable EscapeKey
Global USR32 As Integer = 1
Load Dll "User32.DLL",USR32
Global NewMenu, FileMenu, OldMenu As Integer
#Constant MainWindow = Call Dll( USR32, "GetActiveWindow" )
NewMenu = Call Dll( USR32, "CreateMenu" )
FileMenu = Call Dll( USR32, "CreatePopupMenu" )
OpenMenu = Call Dll( USR32, "CreatePopupMenu" )
r = Call Dll( USR32, "AppendMenuA", OpenMenu, MF_STRING, ID_OPEN, "&Document" )
r = Call Dll( USR32, "AppendMenuA", FileMenu, MF_POPUP, OpenMenu, "&Open" )
r = Call Dll( USR32, "AppendMenuA", FileMenu, MF_STRING, ID_EXIT, "E&xit" )
r = Call Dll( USR32, "AppendMenuA", NewMenu, MF_POPUP, FileMenu, "&File" )
r = Call Dll( USR32, "SetMenu", MainWindow, NewMenu )
Repeat
Until EscapeKey()
goto Quit `run exit cleanup
Quit:
r = Call Dll( USR32, "DestroyMenu", FileMenu )
r = Call Dll( USR32, "DestroyMenu", NewMenu )
r = Call Dll( USR32, "DestroyMenu", OpenMenu )
Delete Dll USR32
End
Pretty Snazzy, eh? Just got to remember the order in which your adding things else you end up with a mess