Hiding the application button on the taskbar in D3

Hi

I had a quick search through previous messages and couldn't find anything
relevant, so excuse me if this has actually been asked a thousand times.

I just upgraded to D3 from D2 (I know I'm behind the times). In D2 I had
made a way of hiding both the main form and the application button on the
taskbar and keeping it that way. I did that by simply setting
'Application.ShowMainForm' to 'False', adding to the Application's
'OnMinimize' and 'OnRestore' events to execute
ShowWindow( Application.Handle, SW_HIDE )' every time, and minimising the
application at the start of execution.

I know this is something of a hack, but it worked well. However I cannot get
it to work quite as successfully under D3. I have an application where there
may or may not be Tool Size windows showing at the start. The problem is
that if no windows are showing at the start, but then one is created
afterwards, the application button reappears on the taskbar. It can be made
to go away again, and for some odd reason it only does this once per
execution. I can find no other case that has the same effect and I've tried
adding to the 'OnActivate' and 'OnDeactivate' events too as above but to no
avail.

I have also tried another way that seems to hide to button, though I don't
quite understand how it works, but generally the procedure is:

WndLong:= GetWindowLong (Application.Handle,GWL_EXSTYLE);
ShowWindow(Application.Handle,SW_HIDE );
SetWindowLong (Application.Handle,GWL_EXSTYLE, WndLong or WS_EX_TOOLWINDOW
and not WS_EX_APPWINDOW);
ShowWindow(Application.Handle,SW_SHOW );

Now this actually works, but it then causes another problem. Any number of
the windows in my program can be set to be TopMost using the SetWindowPos
API. Yet when I use the WindowLong method none of the windows ever go or
stay TopMost. If I make it so the Application is minimised, that fixes this,
but then the application appears as a minimised window in the bottom left of
the screen. Grrrr.

Could anyone shed any light on this? Is there a better way of hiding the
taskbar button in D3. I'm using Win98 by the way and it is NOT a MDI
application.

Thanx in advance

--
Colin Pinkney
-------- Marconi Comms Trainee Software Development Engineer -------
Email C.R.Pink...@dcs.warwick.ac.uk WebSite http://www.cpinkney.org.uk
*-*-*-*-*-*-*-*-* "I am ready to go anywhere, provided it be forward" *-*-*