Home > Software engineering >  Dlg: : OnInitDialog does not perform
Dlg: : OnInitDialog does not perform

Time:12-12

Dlg: : OnInitDialog don't perform, but DoModal succeeded (in a dialog box), this is the DLL project, think impassability, please advise!

CodePudding user response:

MFC DLL export functions start adding AFX_MANAGE_STATE try

Extern "C" BOOL PASCAL EXPORT ExportedFunction ()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
.
}

CodePudding user response:

reference 1st floor zgl7903 response:
MFC DLL export functions start adding AFX_MANAGE_STATE try

Extern "C" BOOL PASCAL EXPORT ExportedFunction ()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
.
}

Predecessors hello, success shows now, I am adding this to the thread function, but now I have a question please comment: project is a DLL, skin can't load, if it is EXE file can be found, it is not clear why
 # include "SkinMagicLib. H" 
# pragma comment (lib, "SkinMagic. Lib")

CMyApp theApp;
CMyDialog MyDialog;

UINT WINAPI StartUpPlugin (LPVOID lpParameter)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
MyDialog. DoModal ();
FreeLibraryAndExitThread (theApp m_hInstance, 1);
Return TRUE;
}

BOOL CMyApp: : InitInstance ()
{
CWinApp: : InitInstance ();

VERIFY (1==InitSkinMagicLib (AfxGetInstanceHandle (), NULL, NULL, NULL));
VERIFY (1==LoadSkinFromResource (theApp m_hInstance, LPCTSTR IDR_SKINMAGIC, "SKINMAGIC"));
M_pMainWnd=& amp; MyDialog;
VERIFY (1==SetWindowSkin (m_pMainWnd - & gt; M_hWnd, "SKINMAGIC"));
VERIFY (1==SetDialogSkin (" Dialog "));
_beginthreadex (0, 0, _beginthreadex_proc_type (StartUpPlugin), 0, 0, 0).
Return TRUE;
}

Int CMyApp: : ExitInstance ()
{
//TODO: add in this dedicated code and/or call the base class
ExitSkinMagicLib ();
Return CWinApp: : ExitInstance ();
}

CodePudding user response:

Used the skin plug-ins, see online say cannot use UNICODE compiled, try to modify multiple bytes in the project properties

  • Related