المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : dll loading itself launching the application



C++ Programming
01-12-2012, 05:51 PM
http://www.barakasoft.com/script/Forums/Images/smiley_line.gif 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\\debu g\\RevolutionProj.dll");
}
[\code]

By simply loading the dll the dll application is launching.. why ??? Thanks Sujan