To answer your first question, you can simply call the default proc for that window (DefWindowProc function). This will result in bypassing the original proc for the panel (defined in the CVI runtime) but it will still call the standard window proc for that type of window. Again, given the code that you attached, this should *not* happen. It's just a fail-safe. You might want to put an Assert statement in there as well.
As for your second question, why is it that the panel disappears when the user hits the close icon? In a standard CVI panel, that only happens if you: 1. handle the EVENT_CLOSE event in the panel's callback, or 2. associate the close icon with a control in your panel, via the ATTR_CLOSE_CONTROL attribute, in which
case an EVENT_COMMIT is sent to this control's callback. In any case, the panel should only go away if you explicitly discard it when processing these events. And if you are explicitly discarding it, can't you clean up the panel id from the functions at that point? I must be missing something, because I'm not understanding the situation very well.
Luis