one floating CDockablePane(CDP). I want to capture the close event when use press 'x' button on the capture area to do something else. MSDN says that I can do it in OnPressCloseButton()
virtual void OnPressCloseButton();
This function is called by the framework when user presses the close button on control bar's caption. Override it in a derived class to get notified about this event.
But it seems not work when CDP is floating, but not docked. When floating the CDP is in one mini frame wnd. The mini-frame wnd will handle this event as follows...
void CPaneFrameWnd::OnLButtonUp(UINT nFlags, CPoint point)
{
m_bIsMoving = FALSE;
if (m_nHit != HTNOWHERE && !m_bCaptured)
{
UINT nHot = m_nHot;
UINT nHit = m_nHit;
StopCaptionButtonsTracking();
if (nHot == nHit)
{
switch (nHit)
{
case HTCLOSE:
if (OnCloseMiniFrame())
{
CloseMiniFrame();
return;
}
break;
................................................
void CPaneFrameWnd::CloseMiniFrame()
{
ShowWindow(SW_HIDE);
if (m_hEmbeddedBar != NULL)
{
CWnd* pEmbeddedWnd = CWnd::FromHandlePermanent(m_hEmbeddedBar);
if (pEmbeddedWnd != NULL)
{
pEmbeddedWnd->ShowWindow(SW_HIDE);
}
}
}
Here the mini-frame wnd tell the embedded wnd to hide itself. Here the embedded wnd is the CDP wnd. So the CDP wnd just receive one WM_SHOWWINDDOW message. But it can't tell this event is triggered by x button.
How to capture the x button event when an CDP is in floating state? Do you have any idea about this? I ask google. But not exact answer...