All menu popups are layered windows, which makes this technique applicable to them.
All VFP menus are owner-draw menus. The WM_DRAWITEM message is sent to the parent window of an owner-drawn menu when its visual aspect has changed. Through this message the window procedure obtains a pointer to the DRAWITEMSTRUCT structure.
This structure contains the hDC for a menu popup window. Pass this hDC to the WindowFromDC function to obtain the window handle (HWND) for the menu pop window.
In VFP9, BINDEVENT() function can intercept Windows messages including the WM_DRAWITEM. Thus a VFP application can be notified whenever any menu popup is redrawn. So the application can intervene and make a popup window transparent or semi-transparent.
To test the MenuManager class, copy the code sample to MenuManager.prg and type in the Command Window:
oManager = NEWOBJECT("MenuManager", "MenuManager.prg")
oManager.SetHook(Application.hWnd) && VFP9 required
After that the VFP System Menu will show semi-transparent. Release the MenuManager object to return the menu back to its normal state.
* * * ContextMenu Control
Designed for generating and displaying shortcut menus on VFP forms. A generated menu is object-oriented: menu items are accessible during runtime, can be modified, added and deleted. A menu can be exported to XML string, as well as loaded from a XML string.
Credits: PHP (4.4.9), an HTML-embedded scripting language,
MySQL (5.1.55-log), the Open Source standard SQL database,
Version 4, freeware HTML Editor of choice. Hosted by Korax Online Inc.