Introduction
I saw several times that there are people who want to know when a CDialogBar
is closed, but only the case when CDialogBar
is in a floating state. I reveal below a simple method and illustrate it in a test application sample.
Using the Code
In order to accomplish this task, we only need to map ON_WM_WINDOWPOSCHANGED
message, and write condition to know when dialog bar has been closed. See the below example:
class CMyDlgBar : public CDialogBar
{
........
afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
DECLARE_MESSAGE_MAP()
};
and implementation:
void CMyDlgBar::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
{
CDialogBar::OnWindowPosChanged(lpwndpos);
if(SWP_HIDEWINDOW & lpwndpos->flags && SWP_NOREDRAW & lpwndpos->flags)
TRACE("The dialogbar has been closed\n");
}
You can find more details in the sample project file. I hope it helps!