Pregunta

I have created a dialog box in my MFC app as below:

BackfaceControlPoints *controlpoints = new BackfaceControlPoints();

controlpoints->Create(BackfaceControlPoints::IDD);

controlpoints->ShowWindow(SW_SHOWNORMAL);

I compiles well, but when I try to run the app I am getting a debug assertion at the moment when trying to create the dialog.

Below are the lines at dlgcore.cpp where I am getting the debug assertion at.

if (!_AfxCheckDialogTemplate(lpszTemplateName, FALSE))

{ ASSERT(FALSE); // invalid dialog template name

I am using a seperate dll for this project (to load it from the main project of the solution.) and "use mfc in a static lubrary" option. Please help me. Thanks.

¿Fue útil?

Solución

Usually that error happens when MFC can't find your dialog in the resources. Your project sounds a little weird because it sounds as if you are creating MFC libraries and linking them and the app statically?

Before your call to controlpoints->Create(), call AfxSetResourceHandle() with the HINSTANCE of the DLL that contains the dialog resource. You may want to reset it back to the original state after the call if you start getting weird resource related fails.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top