CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2000
    Posts
    8

    AfxGetApp in DLL

    I am working on the project which is composed of a main EXE with several DLLs. I am trying to get a pointer to the main app (not dll app) by using
    AfxGetApp and casitng it but I keep getting a pointer to my DLL app.

    How do I get a pointer to the main app.

    Thanks





  2. #2
    Join Date
    Feb 2001
    Location
    Germany
    Posts
    20

    Re: AfxGetApp in DLL

    Hi,

    try this in your dll code:

    // switch thread state back to application
    _AFX_THREAD_STATE* pState = AfxGetThreadState();
    AfxSetModuleState(pState->m_pPrevModuleState);

    // do something with the application

    AfxGetApp()->...

    // switch thread state back to dll
    AFX_MANAGE_STATE(AfxGetStaticModuleState())



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured