[vtkusers] assert afxcurrentinstancehandle null calling vtkMFC dll from exe

Gishara Indeewarie gish.777 at gmail.com
Wed Jul 18 04:37:14 EDT 2012


Dear all,

I have a MFC app where I am calling vtkMFC.dll from the exe. There I am
getting a debug assertion as below in afxwin1.inl.

{ ASSERT(afxCurrentInstanceHandle != NULL);

I tried to use AfxSetResourceHandle(GetModuleHandle("vtkMFC.dll")) but
still getting the same error. I am using VS 2008.Below is my code:

    AFX_MANAGE_STATE(AfxGetStaticModuleState())
    CWaitCursor WC; // sometimes takes a while to start
    CCCADApp *app = (CCCADApp *)AfxGetApp();
    CFrameWnd *frame = app->pVtkTemplate->CreateNewFrame( this, NULL );
    // first init creates the view
    app->pVtkTemplate->InitialUpdateFrame( frame, this, FALSE);
    CvtkMDIView* view= dynamic_cast<CvtkMDIView*>(frame->GetActiveView());
    //
    // automatic correction - try to load initial field if solution is
not available
    if(run->GetStatus()==CDawesRun::NOTRUN)
options=VTKInitialField|VTKGrid|(options & VTKView2D);
    if(view) view->setData(run,options,variable); // set data
    // show the view and frame
    app->pVtkTemplate->InitialUpdateFrame( frame, this, TRUE);

 Please help me.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120718/28aaf148/attachment.htm>


More information about the vtkusers mailing list