Look Friends Now I am not calling the dll from not winn32 but from another mfc exe application. Where I have a button when I press it I should load the dll and launch the mainwindow. See my two apis Code: void CClientRevProjDlg::OnBnClickedButton1() { typedef VOID (*MYPROC)(HWND); HINSTANCE hinstLib; MYPROC ProcAdd; BOOL fFreeResult, fRunTimeLinkSuccess = FALSE; HWND h = AfxGetMainWnd()->GetSafeHwnd(); // Get a handle to the DLL module. hinstLib = LoadLibrary(L"C:\\Users\\DasmahapatraS\\Projects\\Bhagavan_Cadem\\RevolutionProj\\debug\\RevolutionProj.dll"); // If the handle is valid, try to get the function address. if (hinstLib != NULL) { ProcAdd = (MYPROC) GetProcAddress(hinstLib, "runAppli"); // Do add operation // If the function address is valid, call the function. if (fRunTimeLinkSuccess = (ProcAdd != NULL)) (ProcAdd) (h); // Free the DLL module. fFreeResult = FreeLibrary(hinstLib); } // If unable to call the DLL function, use an alternative. if (! fRunTimeLinkSuccess) printf("message via alternative method\n"); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //And in the dll App.cpp I have an extern "C" like this.... extern "C" BOOL __declspec(dllexport) runAppli(HWND h) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); // HWND h = AfxGetMainWnd()->GetSafeHwnd(); ShowWindow(h,SW_SHOW); return true; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// With this when I press the run button from client exe, my dll mainwindow is shown but crashing and hanging for sometime. Please help me get rid of this problem someone Thanks a lot.