The full story, if anyones interested, goes like this.

We have about 10 client apps and a few server apps.  They have similar user 
interfaces based on previouly defined in-house standards.  They also share a 
large amount of functionality (error logs, todo list etc).

I decided that using a shell app with dynamically loaded add-in's would be a 
good way to go as it 1) would remove a lot of ui code from each project, 2) 
enforce better standards, 3) ease maintenance and 4) ease deployment (?)

So, I created the shell from an existing app by striping all the guts out 
and leaving the ui code behind.  I then created some 'interfaces' such as 
IShell, IShellWindow & IAddIn.

I implemented these interfaces in TInterfacedObject classes inside the shell 
exe and in the Addin DLL's.  The DLL also had some standard startup code 
such as Startup(IShell) -> IAddIn, Shutdown, etc.

So, the DLL would create the class and return the interface pointer to the 
shell.  The Addin could take to the shell via the IShell interface and the 
IShell interface has a method called GetShellWindow which returns a 
IShellWindow interface.

The Addin would display itself inside the shell by using 
IShell.GetShellWindow.GetWorkspace which would return a TWinControl.  This 
all worked quite sweetly, I thought but I guess the redraw/resize problem 
existed - I just didn,t notice it.

However, I was geting problems at shutdown - probably becaseu of unloaduing 
the DLL's before I was finsihed or other sily problems.  So I tried using 
the Interface on COM objects inside a ActiceX DLL.  The problem with this is 
that standard COM can't marhsall a TWinControl so I had to use a simple 
window handle.  This also suffered from the same resizing errors but at 
least the shutdown problems were solved.

I now have a mix of an ActiveX dll - which is really just a DLL with the 
self registration functions - and TInterfacedObject classes inside it.  The 
code is a bit of a mess from all my experimentation so I need to do a clean 
recode but I'm happy that it will now work.



>From: Bevan Edwards <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
>Subject: Re: [DUG]:  Loading forms from dynamic DLL's and enbedding them
>Date: Fri, 12 May 2000 19:56:56 +1200
>
>
>Ok, so I'm coming in a little late on this one, but here goes.
>Having read the other responses, and realising that you've gone for a
>bit of a manual resolution, is it possible that the DLL-based form
>doesn't realise what it's parent application is?  How are you creating
>the form - in the DLL or in your EXE code?  What do you pass in as the
>owner of the form?
>
>Just a few interesting ideas - hope they help in some way.
>
>Regards,
>
>Bevan
>
>
>Peter G Jones wrote:
> >
> > There's a virtual chocolate fish available to the person who can solve 
>this
> > one.
> >
> > I have a DLL that includes a form that I want to display embedded into a
> > shell application.  The DLL is dynamically loaded by the shell which 
>then
> > calls a startup procedure that is exported by the DLL.  To the startup
> > procedure it passes a TPanel.
> >
> > When the embedded form draws itself inside the panel, it get's confused
> > about it's size and the bottom and right of the form is lost outside of 
>the
> > containing panel.
> >
> > I have created a small demo app and dll that demonstrates this which I 
>can
> > provide on request.
> >
> > Has anyone else done this sort of thing succesfully cause this is 
>driving me
> > nuts and I need it fixed, like, last month.
> >
> > ________________________________________________________________________
> > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
> >
> > 
>---------------------------------------------------------------------------
> >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
>
>--
>Bevan Edwards                          mailto:[EMAIL PROTECTED]
>Achieve Software Limited               http://www.achieve.co.nz
>Phone: (64-9) 444-4210                 ICQ: 732011
>Fax:   (64-9) 444-4201
>Mobile:        (64-21) 979-603
>---------------------------------------------------------------------------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to