Just opening-up a new thread to start talking about hiding forms from the taskbar and running forms from the system tray.

Firstly though, because the ShowInTaskBar property is a key player in providing this support, thought I would recap the current methods for hiding a form from the taskbar.

After reviewing the literature and searching various development forums, there seems to be two strategies folks use to hide windows from the taskbar.

1) ITaskBarList
2) Hidden Parent

ITaskBarList (ShowInTaskBar)

ShowInTaskBar utilizes a COM interface called ITaskBarList that can be used to enumerate, add, delete items from the taskbar. However, this property was only half-baked in the current release because I couldn't seem to get it to work properly. Then when talking with the bbChecker bunch, suddenly realized that in order to remove a form from the taskbar, it had to already be in the taskbar (a chicken-egg thingy). Armed with this realization, can now go back into the code and re-implement properly. In the short-term, this would seem to be the most sensible way to implement it in ones script.

code:
; 
; Method One - ShowInTaskBar
;

Break On

$Form = CreateObject("Kixtart.Form")

$Form.Show(2) ; Minimized
$Form.ShowInTaskBar = False
$Form.Show

While $Form.Visible
$=Execute($Form.DoEvents)
Loop

Exit 1

According to MSDN, there are dependencies on the ITaskBarList COM interface. Heres the details of that but based on some of my testing, not convinced that its accurate. Im running Windows NT4 with IE 4.2 and it doesn't work as expected:

quote:

Minimum DLL Version shell32.dll version 4.71 or later
Custom Implementation No
Inherits from IUnknown
Header shobjidl.h
Minimum operating systems Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0

Although I must say - it does provide a very cool effect in that the form starts from the tray, then maximixes to the normal state.

HIDDEN PARENT

Think Chris broadcasted this strategy first but its used by quite a few Windows apps. It involves first creating a hidden parent form, then creating a child popup form and using that as the main form. Here's an exmaple of that:

code:
; 
; Method Two
;

Break On

$Hide = CreateObject("Kixtart.Form")
$Form = CreateObject("Kixtart.Form")

$Form.Center
$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents)
Loop

Exit 1

In terms of running from the system tray, well start by cleaning up ShowInTaskBar a little bit, also will make the WindowState property a read-writeable property to conform more with visual basic dotnet. A writeable WindowState property can be used as a heads-up startup mode for the form ...