Important alert: (current site time 7/16/2013 12:50:04 AM EDT)
 

VB icon

[ Hide form from Taskbar ]

Email
Submitted on: 3/9/2005 4:24:56 PM
By: Eric Wolcott 
Level: Beginner
User Rating: By 4 Users
Compatibility: VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0, VB Script
Views: 32783
author picture
(About the author)
 
     This code hides your form from the taskbar at runtime. Works perfectly. Credit goes to manavo11 from vbforums.com
 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
'Windows API/Global Declarations for :[ Hide form from Taskbar ]
'**************************************
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_APPWINDOW = &H40000
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: [ Hide form from Taskbar ]
' Description:This code hides your form from the taskbar at runtime. Works perfectly. Credit goes to manavo11 from vbforums.com
' By: Eric Wolcott
'
' Assumes:Includes checkbox titled "chkTaskbar"
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=59397&lngWId=1'for details.'**************************************

Private Sub chkTaskbar_Click()
Dim style As Long
Hide
style = GetWindowLong(hwnd, GWL_EXSTYLE)
If chkTaskbar.Value = 0 Then
If style And WS_EX_APPWINDOW Then
style = style - WS_EX_APPWINDOW
End If
Else
style = style Or WS_EX_APPWINDOW
End If
SetWindowLong hwnd, GWL_EXSTYLE, style
App.TaskVisible = CBool(chkTaskbar.Value)
Show
End Sub


Other 57 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
3/9/2005 5:20:54 PMGrayda

Simpler way: app.taskvisible = False
(If this comment was disrespectful, please report it.)

 
3/9/2005 5:28:33 PMEric Szafran

*Grayda* Actually you cannot do that in runtime, its readonly then. So if you have an option in your program to hide itself from the taskbar this API is basicly the only wat to go.
(If this comment was disrespectful, please report it.)

 
3/10/2005 4:45:17 PMLaVolpe

To prevent flicker (hide/show), might want to consider using LockWindowUpdate
(If this comment was disrespectful, please report it.)

 
5/22/2005 8:46:06 PM

You don't even need to do any of that. Just go to the right bar (were caption, etc. is) and And in the "ShowinTaskbar" slot, click "false"
(If this comment was disrespectful, please report it.)

 
7/7/2005 5:02:05 AM

lol @ last comment


Thanx for sharing this great piece of code!
(If this comment was disrespectful, please report it.)

 
9/14/2006 11:29:18 PMMatthew

lol yea that was a goofy comment
(If this comment was disrespectful, please report it.)

 
11/13/2006 3:21:51 PMELIAS EL INMORTAL

ESPECTACULAR Y MUY UTIL EL CODIGO DE Eric Wolcott . MIERDA TIENE 16 AÑOS ,ES UN GENIO Y YO UN GUSANO , PERO BUENO .FELICITACIONES A LOS CREADORES DE ESTE SITIO
(If this comment was disrespectful, please report it.)

 
1/22/2007 9:32:44 AMIcaro

Form1.Showintaskbar = False.
Thx
(If this comment was disrespectful, please report it.)

 
3/19/2007 5:47:50 PMeverything for VB 6

hi everbody,is there anyone to give me
codes for a simple MP3 player in visual basic?I will be pleased if it will be written in clear.THANKS:. :)

(If this comment was disrespectful, please report it.)

 
3/19/2007 5:50:52 PMeverything for VB 6

by the way,is anybody here to give your msn address to talk much about visual basic,,especially to improve programming.. HAVE A NICE DAY
(If this comment was disrespectful, please report it.)

 
3/23/2007 2:43:51 PMvijith

thanks a lot
(If this comment was disrespectful, please report it.)

 
9/7/2007 11:52:57 PMMark Larren Mendoza

there are simpler ways but at least he thought of another way. he's creative enough...im saying this coz i always depend on the properties window...
(If this comment was disrespectful, please report it.)

 
10/29/2008 11:31:34 PMJason Newland

Actually, Me.Visible = False will also hide the app from the task bar
(If this comment was disrespectful, please report it.)

 
4/1/2009 4:05:30 AMabhi

wonderful code!!!
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.