Ryan Sparks
Ryan Sparks

Reputation: 309

Remove Visual C++ Menu Bar

I'm fairly new at c++ programming, and yet I searched around and couldn't find an answer to how to do it, so I'm sorry if this is kind of a stupid question.

Anyway, I'm working on designing a custom window (in Microsoft Visual C++), and I just can't figure out how to remove the menu bar from the window. This is what I'm referring to:

enter image description here

I used an image editing software to put a box around what i want to remove in the program in case i'm not referring to it correctly. Anyway, please tell me what code to remove and/or edit to remove it. (Also, a brief explanation of why would be good because i'm still new to this)

Thanks!

Upvotes: 4

Views: 2635

Answers (1)

Lyubomir Vasilev
Lyubomir Vasilev

Reputation: 3030

You can use the SetMenu() function to show or hide the menubar. Use it like this:

SetMenu(hwnd, NULL);

where hwnd is the handle to the window, which menubar you want to hide.

You can also try using the DestroyMenu() function to destroy the menu, like this:

DestroyMenu(hMenu);

where hMenu is the handle to the menu you want to destroy.

Upvotes: 2

Related Questions