troubleshooting Question

Resource unavailable when calling modeless dialog from regular MFC dll

Avatar of tg_wilk
tg_wilk asked on
Visual C++.NETSystem ProgrammingEditors IDEs
5 Comments1 Solution1401 ViewsLast Modified:
I created a regular MFC dll with some database routines. In the same solution I created another project - MFC SDI application. Within this application I created some dialogs (some modal, some not). I made them work with the functionality exported from the dll.
Now I'm trying to put those dialogs inside the dll. I copied the dialog resources and apropriate classes to the dll project and removed them from application. I try to show modeless Property Sheet in an exported function (the code below). CMyPropertySheet is constructed, the pages are added. The problem occurs when I call Create() for this property sheet. It errors out when trying to find resource for a first property page.
function ::FindResource() returns empty resource.
Now, I'm certain that the ID stated in IDD of the Property Page derived class is the correct one. Is it possible, that the application looks in its resources instead of dll's, even though the function is in the dll? If so, how to make it look for this resource in the dll? It has to be "other dll's friendly" so the solution can't be "from now on look for all resources in this dll", because the final application will use many similar dlls.
ASSERT(pParent);//this is the main window of application
	CMyPropertySheet* pSheet;// my based on CPropertySheet
	if (!pApp->m_pPSBiblioteka) //here I store the pointer to the dialog (as CWnd*)
		CString str = _T("Biblioteka");
		pApp->m_pPSBiblioteka = new CMyPropertySheet(str);//the constructor calls AddPage() for each page
	pSheet = (CMyPropertySheet*)(pApp->m_pPSBiblioteka);
	if (!pSheet->GetSafeHwnd()) pSheet->Create(pParent);//create if it's not already created
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros