by Mick Doherty (7 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (48 Votes)
This turned out to be more difficult to work out than the drawing of a button on the titlebar.
Of course once I'd got it it was simple.
Once again this code uses subclassing so always use the forms close button or the menus exit to stop the project, or you will crash.
API DeclarationsCreatePopupMenu
TrackPopupMenu
AppendMenu
ModifyMenu
DestroyMenu
GetCursorPos
CopyMemory
BitBlt
SetRect
DrawCaption
GetMenuItemRect
GetMenuItemCount
GetPixel
SetPixel
CallWindowProc
SetWindowLong
Download Titled PopupMenu (5 KB)