I am creating a dialog, it’s inherited from CDialogEx
(dialog class name DockColorDlg
), and create another class (ColorDockable
) that’s inheriting from the CDockablePane
class. And in my ColorDockable
class I am creating the instanced of the DockColorDlg
(DockColorDlg m_wndDialog
).
Now I am calling from my Mainfram.cpp and create the dockable window, when I am implementing this then it will work, but after few times or a few build it will not create the window.
calling from my Mainfrm.cpp:
if (!m_wndMyDockablePane.Create(_T("Weaves & Color"), this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_MYDOCKABLEPANE, WS_CHILD | WS_VISIBLE | CBRS_TOP))
{
TRACE0("Failed to create dockable panen");
return -1; // fail to create
}
m_wndMyDockablePane.EnableDocking(CBRS_ALIGN_RIGHT | CBRS_ALIGN_LEFT);
DockPane(&m_wndMyDockablePane);
//this in my ColorDockable.cpp
int ColorDockable::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
TRACE("ColorDockable::OnCreate calledn");
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
if(!m_wndDialog.Create(IDD_DOC_COLOR_DLG, this));
{
TRACE("Failed to create dialogn");
return 0; // Fail to create
}
bool check = m_wndDialog.ShowWindow(SW_SHOWNORMAL);
m_wndDialog.SetWindowPos(NULL, 0, 0, lpCreateStruct->cx, lpCreateStruct->cy, SWP_NOZORDER | SWP_SHOWWINDOW);
//ShowDockableDialog();
return 0;
}
//but its not created TRACE("Failed to create dialogn");
1