Recent

Author Topic: Do not show taskbar button when form displayed.  (Read 10585 times)

xrxca

  • Newbie
  • Posts: 1
Do not show taskbar button when form displayed.
« on: March 12, 2010, 02:10:27 am »
We have a helper application that has a System Tray Icon that can be used to toggle a window with a number of import/export functions available on it, this window is quite small and follows a terminal window open to a text based accounting system so the user can always find it to perform the additional tasks it provides. 

This all works beautifully with lazarus, I've even been able to get it working on a linux box.

The kicker is that I can't seem to hide the taskbar button when a form is displayed, we never want this tool to appear in the taskbar, control of it is always available via system tray, it's pretty easy to get rid of when the form isn't displayed, but when the form is shown the taskbar button always comes back. (The cat came back...)

I've seen messages in my search that indicate others have had problems keeping the taskbar button displayed which is what I want, but have not been able to come up with the magic combo to pull this off.

The Delphi code for this is almost trivial:
Code: [Select]
  ShowWindow(Application.Handle, SW_HIDE);
  SetWindowLong(Application.Handle, GWL_EXSTYLE,
    GetWindowLong(Application.Handle, GWL_EXSTYLE)
    or WS_EX_TOOLWINDOW );

Is there something obvious I'm missing?, I've tried working with all the various FormStyles, Changing the ShowInTaskBar options, creating a second window for display and hiding the first etc.
I'd prefer this to be a cross platform solution, but will take a windows only option...

I could of course do it by coding the windows directly (no LCL) but that kind of defeats the purpose, and makes it more difficult to maintain (add features etc.).

I've been trying under Win32 (Xp/Vista/Win7) with both lazarus 0.9.28.2 fpc-2.2.4 and 0.9.29 fpc 2.4.1

candide

  • New Member
  • *
  • Posts: 14
Re: Do not show taskbar button when form displayed.
« Reply #1 on: March 14, 2010, 05:23:39 pm »
I was looking for same thing today, and i found in this forum :
ShowWindow(GetParent(Form1.Handle),SW_HIDE);

=> it is only for Windows, but for Windows it is OK to hide application in taskbar.

More information in this topic: "TApplication.Handle in Delphi"

RAW

  • Hero Member
  • *****
  • Posts: 868
Windows 7 Pro (x64 Sp1) & Windows XP Pro (x86 Sp3).

 

TinyPortal © 2005-2018