[C++] Change menu/HMENU value?

How can I change the menu/hmenu value of a window? I've tried SetMenu(hwnd, (HEMNU)NEW_ID), but that isn't working.

Does anybody have any ideas? I've tried searching for the answer with no avail.

Thanks!
Last edited on
SetMenu(hwnd, (HEMNU)NEW_ID)
You can't do like that.

If I remember correctly, you need to load menu first:
1
2
HMENU hMenu=LoadMenu(GetModuleHandle(NULL),MAKEINTRESOURCE(NEW_ID));
SetMenu(hwnd,hMenu);
Last edited on
Of course, I'm not trying to load a new menu though, I'm trying to change that ID.

Example:
Window is created bia CreateWindowEx with the HMENU value set to 1.
The user clicks the window.
The WM_LBUTTONDOWN event fires changing the HMENU value to 2, and redraws the window (Which gets that value as a basis for what it draws)
Then reset the value when WM_LBUTTONUP fires, and redraw the window.

That's not exactly what I'm going for, but close enough. I mainly just want to know how to change the HMENU value.
What? It doesn't really work that way...
I was afraid that might be the answer. The main reason I'd want to do this is because I like as little code as possible. Actually, I already wrote the code re-drawing in the approprite areas, now I'm just curious if it's even possible.
Topic archived. No new replies allowed.