C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » .NET Framework »

Show or Hide the Start Button of TaskBar


Posted Date: 08 May 2004    Resource Type: Articles    Category: .NET Framework
Author: sanyam aggarwalMember Level: Bronze    
Rating: 1 out of 5Points: 10



Hide and Show the Start Button in Taskbar

This site is just too formal! After all programmers should have fun! So I decided to add a little hack to it to make it Interesting.

This is just a small snippet to Hide and Show the TaskBar.

I cannot think of any Use of this code except impressing your boss or your colleague.
The code is fairly simple. You will be able to follow it with the comments.
So here it is:


Option Explicit

'Sets the Window visibility of window specified by hWnd and nCmdShow is the Visibilit State
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long


'Finds a Window based on ClassName or WindowName or Both
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long


' The FindWindowEx function retrieves a handle to a window whose class name and window
' name match the specified strings. The function searches child windows, beginning with the
' one following the given child window. This function does not perform a case-sensitive search.

Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Dim OurParent As Long
Dim ourHandle As Long

Public Function HideStartButton()

' This Function Hides the Start Button'

' Get the handle of Taskbar Window
OurParent& = FindWindow("Shell_TrayWnd", "")

' Get the Handle of Start Button using the Taskbar Handle
ourHandle& = FindWindowEx(OurParent&, 0, "Button", vbNullString)

'Hide the Start Button
ShowWindow ourHandle&, 0
End Function


'Reverse the Process followed in Showing the Window
Public Function ShowStartButton()
'This Function Shows the Start Button'
OurParent& = FindWindow("Shell_TrayWnd", "")
ourHandle& = FindWindowEx(OurParent&, 0, "Button", vbNullString)
ShowWindow ourHandle&, 5
End Function






Responses

Author: Abel Knezevic    10 May 2004Member Level: Bronze   Points : 0
This is a cool nugget. Awesome for pranks! :)


Author: the dude    12 Nov 2005Member Level: Bronze   Points : 0
Nice code dude, but notice something. Long data type in vb.net = 8 bytes, and integer = 4 bytes, so it doesnt work until you remove the "&" and change long for integer ;-)

cheers.
bye


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Displaying Background Images in Listbox and TextBox
Previous Resource: Introduction to Connection Pooling
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use