I have again a problem 
In an app I'm enabling and disabling (graying) menu items based on the state of the data (saved, dirty etc.). EnableMenuItem does this, but the menu does not get updated immediately- only after moving mouse on some menu item.
So, after reading API docs, I came to conclusion that DrawMenuBar was the function to use to update the menu.
There my problems started. Calling this function crashes my system (Win98 or NT 4) - no system resources left.
I call this function in the main window procedure after END SELECT just before calling the default window procedure.
In my systems I can demonstrate this by taking SKELETON.BAS sample program and making following modification in the end of WndProc function.
After running the program at least I have to point my finger to reset button, no other way.
So, two questions:
Can anybody tell me what I am doing wrong?
How do I refresh the menu after enabling/disabling some items?
TIA
Lasse Rantanen
[email protected]

In an app I'm enabling and disabling (graying) menu items based on the state of the data (saved, dirty etc.). EnableMenuItem does this, but the menu does not get updated immediately- only after moving mouse on some menu item.
So, after reading API docs, I came to conclusion that DrawMenuBar was the function to use to update the menu.
The DrawMenuBar function redraws the menu bar of the specified window. If the menu bar changes after the system has created the window, this function must be called to draw the changed menu bar.
BOOL DrawMenuBar(
HWND hWnd // handle to window with menu bar to redraw
);
BOOL DrawMenuBar(
HWND hWnd // handle to window with menu bar to redraw
);
I call this function in the main window procedure after END SELECT just before calling the default window procedure.
In my systems I can demonstrate this by taking SKELETON.BAS sample program and making following modification in the end of WndProc function.
Code:
END SELECT DrawMenuBar hWnd ' <-- Add this line FUNCTION = DefWindowProc(hWnd, wMsg, wParam, lParam) END FUNCTION
So, two questions:
Can anybody tell me what I am doing wrong?
How do I refresh the menu after enabling/disabling some items?
TIA
Lasse Rantanen
[email protected]
Comment