Board index » delphi » Hiding Taskbar buttons

Hiding Taskbar buttons

I am in the process of splitting a large program into a launcher that
launches a series of com viewers - each one (at the moment) in an
in-process server (dll).  However when each viewer window is opened
(potentially many instances for each viewer) I get a button on the
taskbar.  

How can I avoid this button being created.

Regards
Keith.

 

Re:Hiding Taskbar buttons


<<Keith Giddings:
a series of com viewers - each one (at the moment) in an
in-process server (dll).  However when each viewer window
is opened (potentially many instances for each viewer) I get
a button on the taskbar.

Quote

This happens because DLL forms are unparented.
You can fix it by passing in a parent form's handle
- which can be the application's handle - to the DLL
routine and using the CreateParented method:

procedure ShowMyForm(ParentWnd: HWND);
var
  MyForm : TMyForm;
begin
  MyForm := TMyForm.CreateParented (ParentWnd);
  MyForm.ShowModal;
  MyForm.Free;
end;

Then call it like this
  ShowMyForm(Application.Handle);
This also allows modal forms to work properly.

--
Deborah Pate

Re:Hiding Taskbar buttons


In article <8f1gke$7...@bornews.borland.com>,

Quote
d.p...@cableinet.co.not-this-bit.uk (Deborah Pate) wrote:
> This happens because DLL forms are unparented.
> You can fix it by passing in a parent form's handle
> - which can be the application's handle - to the DLL
> routine and using the CreateParented method:

> procedure ShowMyForm(ParentWnd: HWND);
> var
>   MyForm : TMyForm;
> begin
>   MyForm := TMyForm.CreateParented (ParentWnd);
>   MyForm.ShowModal;
>   MyForm.Free;
> end;

> Then call it like this
>   ShowMyForm(Application.Handle);
> This also allows modal forms to work properly.

> --
> Deborah Pate

Thanks Deborah.  What happens if the dll is on a different machine - is
there a solution then?  I ask because the form class is also used to
generate material for a web page (its not shown) and I can see a situation
in the future where the dll is run under MTS or as an exe via DCOM.  

Regards
Keith.

Re:Hiding Taskbar buttons


<<Keith Giddings:
What happens if the dll is on a different machine

Quote

I don't see why this should be a problem, since
DLL servers are in-process with your app. But that
probably just shows the colossal scale of my ignorance.
I have to pass on all DCOM questions, I'm afraid,
as I've only ever used standalone computers.

--
Deborah Pate

Re:Hiding Taskbar buttons


<<Deborah Pate:
DLL servers are in-process

Quote

Here's a URL for information on loading DLL
servers into surrogate EXEs:

http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/cdo/kl
uaover_34a7.htm

--
Deborah Pate

Re:Hiding Taskbar buttons


In article <8f1gke$7...@bornews.borland.com>,

Quote
d.p...@cableinet.co.not-this-bit.uk (Deborah Pate) wrote:
> This happens because DLL forms are unparented.
> You can fix it by passing in a parent form's handle
> - which can be the application's handle - to the DLL
> routine and using the CreateParented method:

I tried doing as you said, using the CreateParented call in the dll, and
it doesn't work - no viewer window is shown.  When I open a viewer from my
main program I call the viewers show method which does the following:

  FViewer := TViewer.CreateParented(ParentWindow);
  FViewer.OnClosingForm := FormClosing;
  FViewer.Show;

I tried changing the exe method to pass in my MainWindow handle instead of
the Application handle and it made no difference.  

One thing that may be worth pointing out is that these forms are not
hosted inside another window, they can be moved over the whole screen area
in a similar manner to the edit window(s) in delphi.  The help for
CreateParented does imply that you only use it if your window is hosted in
a non vcl window.

If I set the window as a ToolWindow, the problem is solved, but the users
don't like the small caption.

Later:

I managed to get it working by overriding CreateParams for the form and
removing WS_CHILD.  Because my forms are freely movable and not hosted in
another container I needed overlapping windows not child windows.  A
normal delphi form fits this bill but using CreateParented adds the
WS_CHILD flag to the windows style. (Only took me two days to find that
:-) )

Regards
Keith.

Re:Hiding Taskbar buttons


<<Keith Giddings:
I tried doing as you said, using the
CreateParented call in the dll,

Quote

My apologies, I see I shortcircuited my
code example - I meant your COM object
to call it (dlls can just use Create(application)
if you pass in the Application reference - no
need for CreateParented). But I'm glad to
see you got it sorted out anyway. :)

--
Deborah Pate

Other Threads