by Nigel Stratton (1 Submission)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (5 Votes)
This code programatically creates a regular menu on a form using API's, then handles menu clicks using the SetWindowLong and CallWindowProc API's. If you add a menu item at run time you cannot access it within your regaulr code you have to subclass the menu. This shows how to do that. I have seen some submissions with the system menu but did not see one for a regular menu.
Side Effects
If you debug the program it crashes because the GUI is hooked to your app not the ide.
Download Subclassed Menu (8 KB)