Board index » Visual Studio » Enable/Disable Taskbar

Enable/Disable Taskbar

Visual Studio230
I know I can fill the screen in VB.NET by starting my window maximized and

without a border.



My question is; in VB.NET is there a way to enable/disable the taskbar much

like doing the "always on top" feature? I would like my program to

automatically "hide" the taskbar when running.



Thanks.



John


-
 

Re:Enable/Disable Taskbar

XP is the operating system to enable/disable the taskbar, but if you want to

hide it then follow these steps:



Start a new Windows application & add two button (Button1 & Button2

respectively)



Button1 will be show Taskbar

Button2 will be hide the Taskbar



Declarations:



Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal

lpClassName As String, ByVal lpWindowName As String) As Integer

Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Integer, ByVal

hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal cx

As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer



Public Const SWP_HIDEWINDOW = &H80

Public Const SWP_SHOWWINDOW = &H40



Now, doule-click Button1 & add the following code:



Dim intReturn As Integer = FindWindow("Shell_traywnd", "")

SetWindowPos(intReturn, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)



Lastly, double-click Button2 & paste in this code:



Dim intReturn As Integer = FindWindow("Shell_traywnd", "")

SetWindowPos(intReturn, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)



Run the program & click button 2 to hide the Taskbar & button1 to show it.



Remember, to show the Taskbar on form closing or you'll have no Taskbar.



I hope this helps.



"JohnProgrammer" wrote:



Quote
I know I can fill the screen in VB.NET by starting my window maximized and

without a border.



My question is; in VB.NET is there a way to enable/disable the taskbar much

like doing the "always on top" feature? I would like my program to

automatically "hide" the taskbar when running.



Thanks.



John

-

Re:Enable/Disable Taskbar

Excellent, that was just the ticket! Many thanks.



John



"Crouchie1998" wrote:



Quote
XP is the operating system to enable/disable the taskbar, but if you want to

hide it then follow these steps:



Start a new Windows application & add two button (Button1 & Button2

respectively)



Button1 will be show Taskbar

Button2 will be hide the Taskbar



Declarations:



Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal

lpClassName As String, ByVal lpWindowName As String) As Integer

Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Integer, ByVal

hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal cx

As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer



Public Const SWP_HIDEWINDOW = &H80

Public Const SWP_SHOWWINDOW = &H40



Now, doule-click Button1 & add the following code:



Dim intReturn As Integer = FindWindow("Shell_traywnd", "")

SetWindowPos(intReturn, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)



Lastly, double-click Button2 & paste in this code:



Dim intReturn As Integer = FindWindow("Shell_traywnd", "")

SetWindowPos(intReturn, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)



Run the program & click button 2 to hide the Taskbar & button1 to show it.



Remember, to show the Taskbar on form closing or you'll have no Taskbar.



I hope this helps.



"JohnProgrammer" wrote:



>I know I can fill the screen in VB.NET by starting my window maximized and

>without a border.

>

>My question is; in VB.NET is there a way to enable/disable the taskbar much

>like doing the "always on top" feature? I would like my program to

>automatically "hide" the taskbar when running.

>

>Thanks.

>

>John

-