Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating Menus
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00501072
Message ID:
00502813
Views:
20
Sure here :)
DECLARE INTEGER CreatePopupMenu IN WIN32API
DECLARE INTEGER InsertMenu IN WIN32API INTEGER, INTEGER, INTEGER, INTEGER, STRING
DECLARE INTEGER TrackPopupMenu IN WIN32API INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER
DECLARE INTEGER DrawMenuBar IN WIN32API INTEGER
DECLARE INTEGER GetActiveWindow IN WIN32API
**** These are only required if you want to add an image to the item
DECLARE INTEGER LoadImage IN win32api INTEGER,STRING,INTEGER,INTEGER,INTEGER,LONG
DECLARE INTEGER SetMenuItemBitmaps IN win32api INTEGER,INTEGER,INTEGER,INTEGER,INTEGER

**** Need to get the window handle of the window
lhWindowHandle = GetActiveWindow()

**** Create the new popup menu and get the handle
lhMenuHandle = CreatePopupMenu()

lnItemCount = 1
lnSuccess = InsertMenu(lhMenuHandle, lnItemCount, 1024, ;
	lnItemCount, "Text One")
**** Must redraw the menu each time we add a new item to the list
lnSuccess = DrawMenuBar(lhWindowHandle)

**** Set a picture image for the selected item
lcBitmap = "D:\SHE Client Server\GRAPHICS\Shortcut Menu Graphics\Company.bmp"
lnImageHandle = LoadImage(0, lcBitmap, 0, 12, 12, 48)
SetMenuItemBitmaps(lhMenuHandle, lnItemCount -1, 1024, lnImageHandle, lnImageHandle)

lnItemCount = lnItemCount + 1
**** Add a separator to the menu
lnSuccess = InsertMenu(lhMenuHandle, lnItemCount, 2048, ;
	lnItemCount, "")

**** set the position of where to show the menu
lnX = 0
lnY = 0
lnSuccess = TrackPopupMenu(lhMenuHandle, 256, lnX, lnY,0, lhWindowHandle, 0)

CLEAR DLLS
There is a whole bunch of other options to go with all those functions, but I haven't really looked into them yet.
A fish this fine deserves to be a fish nugget styled chunklet.
- Fry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform