OpenGL/MFC MDI/Context overlap...


I have a question I thought I would bring to the board, as that I’ve been dodging this problem since moving to MFC from GLUT.

Typically, I use MDI or SDI for my OpenGL programs. I have had great success with all the aspects of incorporating Windows Message Handlers and such, in place of the tools that GLUT provides. Unfortunately, one bothersome details escapes me. That would be the context overlapping my drop down menus.

To step back for just a second, I encapsulate the entire GL drawing routine and buffer swap with a boolean variable to toggle active state. If a dialog pops up, or some other window obtains focus, the variable drops to false, and no redraw or update occurs. Though I don’t know if this is the most proffessional method to preventing improper drawing (ala GL context drawing over other GDI contexts), it works well for me.

Having said that, whenever the File->Exit or About->Quit menu is navigated though (mouse or otherwise), the GDI context clips them completely. I have tooled with WS_CLIPSIBLINGS and other settings, but I’ve run out of ideas. So now the question:

Does anyone know of a method (or Message Handle) to detect when a user is navigating the menu system?

I’ve spent too many hours reading through articles on MSDN, only to come up empty-handed. If I could tie a Message Handle to the boolean active toggle, it would resolve this issue.

Any comments or criticisms are welcome.



Just few thoughts.

1)Check for non-client paint messages
2)I’m sure there is a function that will get you your command id of the menu item when a mouse pointer hovers above the menu item.

In msdn checkout MENU topic and I’m sure you’ll find something

Try ::MenuItemFromPoint() win32 function.

The MENU topics in msdn are under

platform sdk\user interface services\windows user interface\resources\menus

in case you didn’t know.

Great! Thanks JD. I’ll take a look. I had looked over the CMenu topics previously.

I just need to shake off the Wizard to generate those MFC apps. One day…