• Welcome to Valhalla Legends Archive.
 

Hiding from Taskbar

Started by Mr. Neo, January 02, 2005, 09:31 PM

Previous topic - Next topic

Mr. Neo

I'm trying to make a window that globally floats above everything else, and then also doesn't show up in the taskbar.  I've gotten the globally floating part down by using the SetWindowPos() API which works out nicely.  Now, I'm just a bit stuck on how to get rid of the program from the taskbar.  I found some Delphi sites using the ShowWindow() API, but when I use this in my application it hides the entire taskbar while the application has focus.  Even when the application doesn't have focus, the taskbar appears with the application there and all.

Any ideas?

Newby

Let Windows Explorer crash, and when it restarts your application won't be there until you click on it! :p

How about Form.ShowInTaskbar?
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

Stealth

ShowInTaskbar is read-only at runtime, however, a Google search for "ShowInTaskbar" yielded this link as the first result. Looks good.
- Stealth
Author of StealthBot

Newby

He could change the state in the Properties window, which is what I was aiming for.
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

Mr. Neo

Quote from: Stealth on January 02, 2005, 11:28 PM
ShowInTaskbar is read-only at runtime, however, a Google search for "ShowInTaskbar" yielded this link as the first result. Looks good.

Thank you Stealth, this is exactly what I was looking for.  Works like a charm.

Blaze

Wouldn't Me.Hide and Me.Visible do the exact same thing? It seems to work for my applications.
Quote
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

Stealth

Quote from: Blaze on January 03, 2005, 03:25 PM
Wouldn't Me.Hide and Me.Visible do the exact same thing? It seems to work for my applications.

Those two will disappear the form as well.
- Stealth
Author of StealthBot

Mr. Neo

That link that Stealth provided worked perfectly in Visual Basic.  But, it didn't work at all in REALbasic.  A quick search and a bit of modification yielded this working code.

Sub ShowInTaskbar(Visible As Boolean, hwnd As Integer)
  Declare Function ShowWindow Lib "user32" (ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer
  Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (hwnd As Integer, nIndex As Integer) As Integer
  Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (hwnd As Integer, nIndex As Integer, dwNewLong As Integer) As Integer
 
  Dim SW_HIDE As Integer
  Dim SW_SHOW As Integer
  Dim GWL_EXSTYLE As Integer
  Dim WS_EX_TOOLWINDOW As Integer
  Dim L As Integer
 
  SW_HIDE = 0
  SW_SHOW = 5
  GWL_EXSTYLE = -20
  WS_EX_TOOLWINDOW = &H80
  L = ShowWindow(hwnd, SW_HIDE)
  If Visible = False Then
    L = SetWindowLong(hwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW)
  Else
    L = SetWindowLong(hwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW)
  End If
  L = ShowWindow(hwnd, SW_SHOW)
End Sub