Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hiding icon for DLL form

10 views
Skip to first unread message

Aaron Sherber

unread,
Mar 13, 2000, 3:00:00 AM3/13/00
to
I've been doing my homework on Deja, but I can't seem to get this one
right.

I'm writing a DLL plugin for some other app. The DLL displays a form that
does some things. What I want is for my DLL form to appear as a modal
child of the main app -- that is, the app's main window can't get focus
as long as my form is open, and my form does not display a taskbar icon.

I have tried many of the suggestions involving overriding CreateParams,
using CreateParented (I do have the handle of the app's main window), and
creating my form as a ToolWindow. ToolWindow almost works, except that I
can click on the app's taskbar icon to give it focus (but I can't do
anything with it), and then I have no way of re-focusing my form to close
it. Also, I don't like the narrower caption bar of a ToolWindow.

When I have tried using CreateParented or setting Params.WndParent to the
app's handle in CreateParams, something seems to go wrong somewhere in
the Create, and my form never shows.

If anybody has any suggestions, I'd be grateful. I'm using D3.

TIA,
Aaron Sherber.


Jeff Overcash (TeamB)

unread,
Mar 13, 2000, 3:00:00 AM3/13/00
to
How are you creating the form in the Dll? Sounds like you are using
Application.CreateForm. Don't use that, instead call the Form's Create method.
Dll's have their own Application object so when you call CreateForm for the
first time the Dll's Application object will make that the MainForm for that
"application" and you get the icon. With Dll's you need to pass the exe's
application object (or assign its handle to the Dll's application's handle) to
make it use the Exe's Application.

If you used Packages instead of Dll's these problems go away. Anything you want
to do with Dlls you can do with packages and for VCL exes it will simplify a lot
of issues.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
If there is somebody up there could they throw me down a line. Just a
little helping hand just a little understanding. Just some answers to the
questions that surround me now. If there's somebody up there could
they throw me down a line. (Fish)

Aaron Sherber

unread,
Mar 13, 2000, 3:00:00 AM3/13/00
to
In article <38CD2E88...@onramp.net>, over...@onramp.net says...

> How are you creating the form in the Dll? Sounds like you are using
> Application.CreateForm. Don't use that, instead call the Form's Create method.

That's what I'm doing. The app calls a method in my DLL that essentially
does:

ConfigForm := TConfigForm.Create(Application);
try
ConfigForm.ShowModal;
finally
ConfigForm.Free;
end;

> With Dll's you need to pass the exe's
> application object (or assign its handle to the Dll's application's handle) to
> make it use the Exe's Application.

Hmm. Okay, I tried adding

Application.Handle := MainAppWindowHandle;

before the code above, but then something fails in the Create. Same thing
happens if I try to do Params.WndParent := MainAppWindowHandle in
CreateParams or just ParentWindow := MainAppWindowHandle.

> If you used Packages instead of Dll's these problems go away.

Yes, except that I'm writing these plugins for a third-party commercial
app. I suppose I could write a DLL that just has the necessary exports
and then call a Package from that, but that seems like the long way
around.

Thanks,
Aaron.

Jeff Overcash (TeamB)

unread,
Mar 13, 2000, 3:00:00 AM3/13/00
to

Aaron Sherber wrote:
>

> Hmm. Okay, I tried adding
>
> Application.Handle := MainAppWindowHandle;

No, you need to pass the Application Handle from the EXE to the Dll. That is
not the same as the main window's handle.

>
> before the code above, but then something fails in the Create. Same thing
> happens if I try to do Params.WndParent := MainAppWindowHandle in
> CreateParams or just ParentWindow := MainAppWindowHandle.
>
> > If you used Packages instead of Dll's these problems go away.
>
> Yes, except that I'm writing these plugins for a third-party commercial
> app. I suppose I could write a DLL that just has the necessary exports
> and then call a Package from that, but that seems like the long way
> around.
>

Then try passing nil as the owner and free it yourself since you already are
doing that. Don't pass the application as the owner since you won'r be abvle to
sync up with the exe's Application object since it does not always exist.

> Thanks,
> Aaron.

Aaron Sherber

unread,
Mar 13, 2000, 3:00:00 AM3/13/00
to
In article <38CD9610...@onramp.net>, over...@onramp.net says...

> No, you need to pass the Application Handle from the EXE to the Dll. That is
> not the same as the main window's handle.

I understand that it's not the same, but (a) this is a commercial app
that doesn't have an Application object, and (b) I'm writing to the specs
of an existing PDK, so I have no control over what aspects of the app I'm
given access to.

> Then try passing nil as the owner and free it yourself since you already are
> doing that. Don't pass the application as the owner since you won'r be abvle to
> sync up with the exe's Application object since it does not always exist.

I've tried passing nil as the owner, and I do free it myself. I still
can't figure out how to prevent it from showing on the taskbar, and how
to prevent the main app getting focus even while my form is showing
modally.

Thanks,
Aaron.


Jeff Overcash (TeamB)

unread,
Mar 13, 2000, 3:00:00 AM3/13/00
to
Try setting Application.ShowMainWindow to false in the Dll see if that will
help.

Aaron Sherber

unread,
Mar 15, 2000, 3:00:00 AM3/15/00
to
In article <38CDBCBC...@onramp.net>, over...@onramp.net says...

> Try setting Application.ShowMainWindow to false in the Dll see if that will
> help.

I'm using D3 and don't have this property. I did try the equivalent:

SetWindowLong(Application.Handle, GWL_EXSTYLE, GetWindowLong(
Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);

but that didn't work.

The interesting thing is that if I do ShowMessage(Application.ExeName)
from within the DLL, I get the name of the main application, not the name
of my DLL.

Aaron Sherber.

0 new messages