I was writing a stupid app to help my friend learn to use menus in windows apps. It would call TrackPopupMenu on a WM_LBUTTONDOWN message. After some experimentation, I found that if I leftclicked in the client are, the menu would appear, as it should. But if, while the menu was still active, I leftclicked in the window's nonclient area (titlebar), the menu would appear elsewhere. By clicking the menu receives a WM_LBUTTONDOWN message, and determines that it should close the menu as it's not inside the menu, and it doesn't remove the message. This is normally fine, but if the click falls on the nonclient area of a window, the message should not be passed through. I believe this also applies to WM_LBUTTONDBLCLK, and the right button equivalents.
Is there an easy way to determine what window the click would be passed through to, so we can check if it'll be in the client area or not?
Bobby Bingham