Re: Failed to create CBasePane or derived class outside of MainFra
Here is a code sample (two projects: SDI application and DLL that contain a
Cpanedialog)
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
.......
.....
......
CPaneDialog *m_wndDlgBar = NULL;
HMODULE hDynamicObject = ::LoadLibrary(_T("child.dll"));
if (hDynamicObject != NULL)
{
fpCreateDialog fCreate = (fpCreateDialog) ::GetProcAddress
(hDynamicObject, "CreateDialogPane");
m_wndDlgBar = fCreate(m_hWnd);
if (NULL != m_wndDlgBar)
{
m_wndDlgBar->EnableDocking(CBRS_ALIGN_ANY);
DockPane(m_wndDlgBar);
}
}
In the DLL
CPaneDialog* DialogContainer::CreateDlg(HWND hWnd)
{
CWnd* pWndParent = CWnd::FromHandle(hWnd);
// m_temp1 is Cpanedialog
if (!m_temp1.Create (_T("DialogBar"), pWndParent, TRUE,
MAKEINTRESOURCE (IDD_DLG_BAR),
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT |
CBRS_FLOAT_MULTI,
ID_VIEW_DLGBAR))
{
TRACE0("Failed to create Dialog Bar\n");
return NULL; // fail to create
}
return &m_temp1;
}
The process failing on creating the CpaneDialog.
Hope this clarify what I'm trying to accomplish.
Please assist.