MDI Child 
Author Message
 MDI Child

Hi

Synopsis:
    We have a MDI exe that references a bunch of DLL's that supply child
forms to the MDI.
    We currently use the SetParent API to set the MDI as the parent of the
DLL-supplied child form.
    The reason that we follow this approach is that we need the late binding
in order to determine at
    runtime only which DLL's are available to the user.

Error:
    The MDI crashes when exiting one of the Child forms.
    I set the  destroy the form, destroy the reference to the DLL but it
still crashes.

Solutions tried:
    Dan Appleman says in his API Book that one should be circumspect in
using the SetParent API.
    He says that when setting the Parent it should be set back before
termination and I assume that it
    is because Windows now has a different handle on the window from VB's
handle.

    Also tried some .ocx that apparently sets the Parent, but this .ocx
comes with its own set of problems.

Question:
    I need a resolution where a Child form can be passed to a MDI form from
within a DLL.



Tue, 26 Aug 2003 17:04:57 GMT  
 MDI Child
When I remember correctly, there are solutions for your problem,
but it would require subclassing... as MDI child forms have to
send some notification messages to the MDI (parent) window.

Maybe you should change your MDI child forms to ActiveX controls
which can be loaded at run-time with the Form.Controls.Add statement
using the control's Prog-ID.
Your app would have to provide the container (MDI child) for those controls,
so you never have the problems you described.

Alex



Quote:
> Hi

> Synopsis:
>     We have a MDI exe that references a bunch of DLL's that supply child
> forms to the MDI.
>     We currently use the SetParent API to set the MDI as the parent of the
> DLL-supplied child form.
>     The reason that we follow this approach is that we need the late
binding
> in order to determine at
>     runtime only which DLL's are available to the user.

> Error:
>     The MDI crashes when exiting one of the Child forms.
>     I set the  destroy the form, destroy the reference to the DLL but it
> still crashes.

> Solutions tried:
>     Dan Appleman says in his API Book that one should be circumspect in
> using the SetParent API.
>     He says that when setting the Parent it should be set back before
> termination and I assume that it
>     is because Windows now has a different handle on the window from VB's
> handle.

>     Also tried some .ocx that apparently sets the Parent, but this .ocx
> comes with its own set of problems.

> Question:
>     I need a resolution where a Child form can be passed to a MDI form
from
> within a DLL.



Tue, 26 Aug 2003 23:53:20 GMT  
 MDI Child
There are good OCXs for doing what you want. Maybe you chose a not so good
one. I have used MDI-extender and I've found that it's quite slick.
http://www.devcomponents.com/mdiextender.html

regards,
   Sergio



Quote:
> Hi

> Synopsis:
>     We have a MDI exe that references a bunch of DLL's that supply child
> forms to the MDI.
>     We currently use the SetParent API to set the MDI as the parent of the
> DLL-supplied child form.
>     The reason that we follow this approach is that we need the late
binding
> in order to determine at
>     runtime only which DLL's are available to the user.

> Error:
>     The MDI crashes when exiting one of the Child forms.
>     I set the  destroy the form, destroy the reference to the DLL but it
> still crashes.

> Solutions tried:
>     Dan Appleman says in his API Book that one should be circumspect in
> using the SetParent API.
>     He says that when setting the Parent it should be set back before
> termination and I assume that it
>     is because Windows now has a different handle on the window from VB's
> handle.

>     Also tried some .ocx that apparently sets the Parent, but this .ocx
> comes with its own set of problems.

> Question:
>     I need a resolution where a Child form can be passed to a MDI form
from
> within a DLL.



Wed, 27 Aug 2003 01:10:31 GMT  
 MDI Child


Quote:
> Hi

> Synopsis:
>     We have a MDI exe that references a bunch of DLL's that supply child
> forms to the MDI.
>     We currently use the SetParent API to set the MDI as the parent of the
> DLL-supplied child form.
>     The reason that we follow this approach is that we need the late
binding
> in order to determine at
>     runtime only which DLL's are available to the user.

> Error:
>     The MDI crashes when exiting one of the Child forms.
>     I set the  destroy the form, destroy the reference to the DLL but it
> still crashes.

> Solutions tried:
>     Dan Appleman says in his API Book that one should be circumspect in
> using the SetParent API.
>     He says that when setting the Parent it should be set back before
> termination and I assume that it
>     is because Windows now has a different handle on the window from VB's
> handle.

>     Also tried some .ocx that apparently sets the Parent, but this .ocx
> comes with its own set of problems.

> Question:
>     I need a resolution where a Child form can be passed to a MDI form
from
> within a DLL.

Dan Appleman wrote an article in Visual Basic Programmers' Journal 3/99 in
which he described that the SetParent API method was THE WRONG WAY to do
this task. He described how to create a generic MDI client, and implement
each document type as an ActiveX control, and use custom interfaces to make
those ActiveX controls private to that application.

If you're a DevX premier member, you can view the article at
http://www.devx.com/_mem_bin/FormsLogin.asp?/premier/mgznarch/vbpj/19...
r99/da0399.pdf

--
Ken Bloom

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/M/AT/U d- s++:--- a--- C++ UL P++ L+ E----
W+++ N++ ?o ?K w++ !O M++>$ V- PS PE Y-- PGP- t+

------END GEEK CODE BLOCK------



Fri, 29 Aug 2003 10:10:17 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. MDI problem, com MDI to MDI-child

2. MDI problem, com MDI to MDI-child

3. MDI problem, com MDI to MDI child

4. MDI Child ActiveX not treated as true child.

5. Modifying object in MDI Parent form from MDI Child form

6. Make a reference to a MDI form with a reference of a MDI child form

7. Maximized MDI child form Covering Status bar on MDI parent

8. How do you center MDI and MDI Child with 1 chunk of code

9. How to make menu in MDI child appear together with MDI form

10. Non MDI child forms cause MDI application to lose focus

11. Calling MDI child code from MDI parent menu???

12. MDI-Child form and positon on MDI-form

 

 
Powered by phpBB® Forum Software