Home > Software engineering >  DLL loading dialog, repair afxwin1. Inl line: 21
DLL loading dialog, repair afxwin1. Inl line: 21

Time:05-04

Add based on CDialog class dialog DLL project CMainDlg

//instantiate the dialog
CMainDlg * mainDlg;
MainDlg=new CMainDlg;
MainDlg - & gt; Create (IDD_DIALOG_Main); //execution to the program crashes
MainDlg - & gt; ShowWindow (SW_SHOW);

1, the conventional scheme: add AFX_MANAGE_STATE function head (AfxGetStaticModuleState ()),
The macro definition and DllMain () function entrance leads to "fatal error LNK1169: find one or more of the multiple symbols of the definition of" error,
2, the current will plan:
HINSTANCE exe_hInstance=GetModuleHandle (NULL);
HINSTANCE dll_hInstance=GetModuleHandle (" Test. DLL ");
AfxSetResourceHandle (dll_hInstance);//switch state
//function main body
AfxSetResourceHandle (exe_hInstance);//recovery state
before the plan display dialog box, you want to ignore two bugs tip: afxwin1. Inl line: 21
Project properties character set is not set, the plan if you can fix the bug tip also can yet be regarded as a perfect plan!
  • Related