exe application. From the exe application I am trying to load the dll and launch the mainwindow of the dll.For that in dll.....I have the view class there in view implementation file i am declaring a view pointer, like the code below
Code:
//RevolutionProjView.cpp file
CRevolutionProjView *view;
CRevolutionProjView::CRevolutionProjView()
{
view = this;
}
// The I am creating an extern C function by name runAppli like below.
extern "C" BOOL __declspec(dllexport) runAppli(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
view->ShowWindow(SW_SHOW);
return true;
}
Code:
void CClientRevProjDlg::OnBnClickedButton1()
{
typedef VOID (*MYPROC)(void);
HINSTANCE hinstLib;
MYPROC ProcAdd;
BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
hinstLib = LoadLibrary(L"C:\\Users\\DasmahapatraS\\Projects\\Bhagavan_Cadem\\RevolutionProj_OrthoGraphic\\debug\\RevolutionProj.dll");
if (hinstLib != NULL)
{
ProcAdd = (MYPROC) GetProcAddress(hinstLib, "runAppli");
if (fRunTimeLinkSuccess = (ProcAdd != NULL))
(ProcAdd) ();
fFreeResult = FreeLibrary(hinstLib);
}
if (! fRunTimeLinkSuccess)
printf("message via alternative method\n");
}
