' Menu Bar via Win32 DECLARE — CreateMenu, AppendMenu
#COMPILE EXE
#DIM ALL

DECLARE FUNCTION CreateMenu LIB "USER32.DLL" () AS LONG
DECLARE FUNCTION CreatePopupMenu LIB "USER32.DLL" () AS LONG
DECLARE FUNCTION AppendMenu LIB "USER32.DLL" ALIAS "AppendMenuA" (BYVAL hMenu AS LONG, BYVAL uFlags AS LONG, BYVAL uIDNewItem AS LONG, BYVAL lpNewItem AS ASCIIZ) AS LONG

FUNCTION PBMAIN() AS LONG
    LOCAL hMenu  AS LONG
    LOCAL hSubFile  AS LONG
    LOCAL hSubHelp  AS LONG
    PRINT "Menu Bar via Win32 API:"
    hMenu = CreateMenu()
    hSubFile = CreatePopupMenu()
    AppendMenu(hSubFile, 0, 1001, "Exit")
    AppendMenu(hMenu, 16, 0, "File")  ' MF_POPUP = 16
    hSubHelp = CreatePopupMenu()
    AppendMenu(hSubHelp, 0, 2001, "About")
    AppendMenu(hMenu, 16, 0, "Help")
    PRINT "Menu created successfully"
    FUNCTION = 0
END FUNCTION
