-
How to replace a form's menu with one, created with WinAPI?
I create a menu with CreateMenu() func, popupulate it with items and then use SetMenu() to make it belonging to the form. But a VB form always sets its own menu back in some cases (when receives WM_ACTIVATE, or while resizing child windows).
Maybe is there a some more optimal way to set a menu, then subclassing a form and searching every message causing the form to set its own menu back?
-
Solution
I tried to put a menu on a form without its own menu.
The solution is really easy.
First I create any menu for the form in design time and then in runtime destroy it and assign to the form my menu:
Call DestroyMenu(GetMenu(Form1.hWnd))
Call SetMenu(Form1.hWnd, hMyMenu)
It works.