我建了一个纯资源dll文件"OneTest.dll"    (MFC appWizard[DLL])
里面有bmp文件和string
然后在MFC应用程序中调用,代码如下:BOOL COneTestEXEApp::InitInstance()
{    m_hInstance = AfxGetResourceHandle();  
    m_hResourseHandle = LoadLibrary("OneTest.dll");
 
    if (m_hResourseHandle)
    {
        AfxSetResourceHandle(m_hResourseHandle);
    }
    else
    {
        AfxMessageBox("Load library error!");
        PostQuitMessage(1);
        return TRUE;
    }    AfxEnableControlContainer();
    
COneTestEXEDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
  
}
else if (nResponse == IDCANCEL)
{
}
但是执行int nResponse = dlg.DoModal();时对话框出不来
调试进入CDialog::DoModal方法发现int CDialog::DoModal()
{
// can be constructed with a resource template or InitModalIndirect
ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
m_lpDialogTemplate != NULL); // load resource as necessary
LPCDLGTEMPLATE lpDialogTemplate = m_lpDialogTemplate;
HGLOBAL hDialogTemplate = m_hDialogTemplate;
HINSTANCE hInst = AfxGetResourceHandle();
if (m_lpszTemplateName != NULL)
{
hInst = AfxFindResourceHandle(m_lpszTemplateName, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG);
hDialogTemplate = LoadResource(hInst, hResource);
}
if (hDialogTemplate != NULL)
lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate); // return -1 in case of failure to load the dialog template resource
if (lpDialogTemplate == NULL)
return -1;HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG);
返回值为空导致程序退出,请教各位这是怎么回事啊.
是我dll文件有问题吗?应该怎样解决.