Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am coding for a max plugin(*.dlo), a .dll, I build a MFC regular Dll for it and run normally in max, but I can not build the CMainFrame on the dll.
I known the CWinApp::Run() didn't applied to the Dll, I read some papers about making MDI on dll on this forum,but failed when call:
C#
AfxSetResourceHandle(hInstance);
               CSingleDocTemplate* pDocTemplate;
               pDocTemplate = new CSingleDocTemplate(
                            IDR_MAINFRAME,
                            RUNTIME_CLASS(CMFCAPPDoc),
                            RUNTIME_CLASS(CMainFrame),       // main SDI frame window
                            RUNTIME_CLASS(CMFCAPPView));
               CWinApp* app = AfxGetApp();      //no use because app = null why
               Interface* ip = GetCOREInterface();
               CFrameWnd* pMaxFrame = (CFrameWnd*)ip->GetMAXHWnd();
               CMFCAPPDoc*  pDoc  = (CMFCAPPDoc*)pDocTemplate->CreateNewDocument();
               CMainFrame* pFrame = (CMainFrame*)pDocTemplate->CreateNewFrame(pDoc, pMaxFrame);

               pDocTemplate->InitialUpdateFrame(pFrame,pDoc, TRUE);


And AfxGetApp() return NULL out of CWinApp class
so please help everyone?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900