Ok I Just pretty much understand winapi now (well the basics of it) and so i was looking around msdn and i found this. its really easy really it uses 3 dll calls. and returns the number of the menu.
heres some simple code that will make it and return the menu number and make a submenu
remstart
-------------------------------------------------------------------
program name:
-------------------------------------------------------------------
written by: Caleb Stewart
date:
-------------------------------------------------------------------
comments:
-------------------------------------------------------------------
remend
Dim MF_String(0)
Dim MF_Popup(0)
MF_String(0)=0
MF_Popup(0)=16
Sync on
Sync rate 0
WinX=(640/2)/2+25
WinY=(480/2)/2+25
Set window on
Set window position WinX,WinY
Load dll "user32.dll",1
Window = Call dll(1,"GetActiveWindow")
Popup= MakeMenu()
Popup2 = MakeMenu()
Appendmenuitem(Popup,1,"Item 1")
AppendMenuItem(Popup,2,"Item 2")
AppendMenuItem(Popup,3,"Item 3")
AppendMenuItem(Popup2,4,"Item 4")
AppendMenuItem(Popup2,5,"Item 5")
AppendMenu(Popup,Popup2,"More")
TPM_CENTERALIGN = 4
TPM_LEFTBUTTON = 0
TPM_RETURNCMD = 256
Do
If mouseclick()=2
Selected = Call dll(1,"TrackPopupMenu",Popup,TPM_RETURNCMD | TPM_LEFTBUTTON,MouseX()+WinX,MouseY()+WinY,0,Window,NULL)
endif
Text 0,0,str$(selected)
Sync
Cls
Loop
Function MakeMenu()
Menu=Call dll(1,"CreatePopupMenu")
endfunction menu
Function AppendMenuItem(Menu,ID,Txt$)
Call dll 1,"AppendMenuA",Menu,MF_String(0) | MF_Popup(0),ID,Txt$
endfunction
Function AppendMenu(menu,AMenu,Txt$)
Call Dll 1,"AppendMenuA",menu,MF_String(0) | MF_Popup(0),Amenu,Txt$
endfunction
the only problem is you can't position it at mousex mousey because mousex and mousey are relative to the window position which i can't seem to get :/ and the positions you pass to windows arn't so you have to use MouseX()+WindowX,mouseY()+WindowY(if you know how to get window x and window y tell me that would be helpful)
This requires 5 of the windows constants i have a txt file with all the constants i uploaded it if you want it.
New Site! Check it out \/