CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Guest

    How to make a form in a DLL - MDI child to another project

    I have a set of forms in a ActiveX DLL. This DLL is being referred in another standard EXE project.. in which i have a MDI form to which the forms in the DLL are to be made childs...

    How I can achieve this..Please help..

    MARY


  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: How to make a form in a DLL - MDI child to another project

    You can't have MDI child forms in an ActiveX DLL - they need to reference an MDI Parent Form in the same project. There are several ways of accomplishing the same effect (most of which are very ropey, SetParent API call for instance).

    By far the best way that I've seen is Dan Applemans method described at http://msdn.microsoft.com/library/pe...bpj/da0399.htm. It's a complete framework (which means you need to read the whole article to understand it's design) that builds on ActiveX controls kept in separate OCX's.



    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

  3. #3
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: How to make a form in a DLL - MDI child to another project

    <imho> Very dodgy thing to try.


    Declare Function SetParent Lib "user32" Alias "SetParent" (byval hWndChild as Long, byval hWndNewParent as Long) as Long
    '..use
    Dim lPrevParent as Long

    lRet = SetParent(hwndchild, frmMdi.hWnd)



    might work, but be sure to set the parent back before closing the window and note that VB won't know about this child window...

    You will also need to tell the MDI Child forms in the DLL that they are such, using:


    Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (byval hwnd as Long, byval nIndex as Long, byval dwNewLong as Long) as Long
    public Const WS_EX_MDICHILD = &H40
    '...use
    lRet = SetWindowLong(childHwnd,GWL_STYLE, WS_EX_MDICHILD)




    but I'd consider spending a day thinking about another way to do this without the DLL windows being MDI children...sounds like a recipe for a GPF :-(.

    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  4. #4
    Guest

    Re: How to make a form in a DLL - MDI child to another project

    Thanks for the reply...
    Can u please help me on modulerizing my application... I have very large forms. I have almost 75 forms in my application .. Now I wish to some how Modulerize the application as a set of ActiveX DLL's and ActiveX EXE's so as to enjoy all the advantages of COM services and to reduce memory footprint of my application..

    As I am using lot of third party controls from LEAD and Sheriden i am getting lot of memory problems ... That's why I wish to modulerize my application ...

    Please guide me in thinking Three-Tier for my application.... Give me links to any three-tier sample desingns...

    Regards
    Mary


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