Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Switch views in SDI using MFC extention DLL Classes

Switch views in SDI using MFC extention DLL Classes

Scheduled Pinned Locked Moved C / C++ / MFC
c++comdebugginghelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dave Loeser
    wrote on last edited by
    #1

    Hey guys, I've got one that I hope someone can help with: Over on codeguru.com there is an article titled Separating the views of an MDI application into different DLLs What I'm trying to do is create this same fucntionality within a SDI application. This app is workflow based and using an MDI just doesn't work for this type of application. Here's some of what I have; In my DLL, I have exported one function:

    extern "C" AFX_EXT_API UINT Init(CString *strLabel,CRuntimeClass **pRunTimeClass)
    {
    new CDynLinkLibrary(View1DLL);
    *pRunTimeClass = RUNTIME_CLASS(CTestView);
    *strLabel = "View 1";
    return 0;
    }

    In my test application I have a menu that will call this method when selected:

    void CMainFrame::OnViewSwitchtodll()
    {
    HINSTANCE hDLL;
    LPDLLFUNC lpfnDllFunc;
    UINT uReturnVal;
    CString strLabel;
    CRuntimeClass* runtimeclass;

    hDLL = LoadLibrary("View1.dll");
    lpfnDllFunc = (LPDLLFUNC)::GetProcAddress(hDLL,"Init");
    if (!lpfnDllFunc)
    {
        FreeLibrary(hDLL);       
    }
    else
    {
    uReturnVal = lpfnDllFunc(&strLabel,&runtimeclass);
    CAADoc\* pDoc = (CAADoc\*)this->GetActiveDocument();
    pDoc->SwitchToView(runtimeclass);
    }
    

    }

    This loads up the DLL grabs a function pointer to the Init function exported in the DLL and then passes the runtimeclass to the SwitchToView() in my Document class (this was taken from an article on CodeProject). When I step into SwitchToView the runtimeclass object appears to be fine... and I do not receive errors... but the mHwnd of the runtimeclass is ??? in the Variable inspector during debug. I've come to the point where I need someone else to take a look at this - so any help? Thanks in advance, Dave "Dak Lozar" Loeser

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups