When the menu is not active, your panel's hwnd is the topmost visible window. However, it's possible, and maybe even likely, that at any given time the operating system -- or some other application -- might own other windows that are considered to be the topmost window (one way to know more about these windows would be to inspect, in the debugger, the module name returned by GetWindowModuleFileName for the topmost window).
However, I didn't want to rule out the possibility that, under some conditions, no such hidden window exists, in which case we need to make sure that we don't inadevertently skip the "normal" case, i.e. the case in which the topmost window is, in fact, your panel's window.
Luis