-
January 12th, 2012, 08:41 AM
#1
dll loading itself launching the application
Dear Friends
I am loading a dll from another exe mfc application. for that i have exposed one api 'runAppli' in the dll as extern "C". Then I am loading the dll using LoadLibrary. By loading the dll itself the dll application is launched. I am surprised. I should call the api 'runAppli' and then the application should launch but its not happening. How come it is happening please give some suggestions.
Code:
// in the all
extern "C" BOOL __declspec(dllexport) runAppli(CString filename)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if(filename.IsEmpty())
return false;
view->ShowWindow(SW_SHOW);
view->loadProfile(filename);
view->domainSetUpForProfile();
view->drawLines();
view->drawArcs();
view->drawProfile();
return true;
}
//in the client exe application
void CClientRevolutionProjDlg::OnBnClickedButton1()
{
HINSTANCE hinstLib;
hinstLib = LoadLibrary(L"C:\\Users\\sujan.dasmahapatra\\Documents\\Projects\\Bhagavan_SurfaceRevolution\\RevolutionProj\\debug\\RevolutionProj.dll");
}
By simply loading the dll the dll application is launching.. why ??? Thanks Sujan
Last edited by Marc G; January 13th, 2012 at 02:57 AM.
Reason: Fixed code tags
-
January 12th, 2012, 08:51 AM
#2
Re: dll loading itself launching the application
By simply loading the dll the dll application is launching.. why ???
If your dll is MFC regular dll, the behavior is by design. MFC framework launches application class' InitInstance when global theApp instance is constructed. This happens exactly at dll load time.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|