如何查看 動態庫資源 衝突問題
在調用資源前使用
以下是在 dll 中的定義
CLDCControlDialog * CLDCFilesControl::DoModalPropertyDlg03(HWND hParent)
{
m_pPropertyDlg = new CFilesPropertyDlg2(CWnd::FromHandle(hParent));
}
以下是 EXE 對 dll的調用
CDialog * CLeadShowView::DoModalPropertyDlg03(CLDCControl40 *pCtrl, CWnd *pEdtWnd)
{
//AFX_MANAGE_STATE(AfxGetAppModuleState());
m_pLDCControlDialog = pCtrl->DoModalPropertyDlg03(this->m_hWnd);
}
要判斷在dll彈出對話框時,dan當前資源需要做
CLDCControlDialog * CLDCFilesControl::DoModalPropertyDlg03(HWND hParent)
{
HINSTANCE dll_hInstance = AfxGetResourceHandle(); !!!
m_pPropertyDlg = new CFilesPropertyDlg2(CWnd::FromHandle(hParent));
}
CDialog * CLeadShowView::DoModalPropertyDlg03(CLDCControl40 *pCtrl, CWnd *pEdtWnd)
{
HINSTANCE exe_hInstance = AfxGetResourceHandle(); !!!
m_pLDCControlDialog = pCtrl->DoModalPropertyDlg03(this->m_hWnd);
}
然後只需要看 dll_hInstance 和 exe_hInstance 區別,如果相同,說明調用資源仍然是exe的資源,
dll_hInstance應該等於
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
}
中的hInstance 參數