-
Apr 5th, 2008, 03:04 AM
#1
Thread Starter
Hyperactive Member
Hiding the taskbar
Here is how one might go about hiding the taskbar:
Code:
Private Declare Function apiFindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32
Private Declare Function apiFindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal lpsz1 As String, ByVal lpsz2 As String) As Int32
Private Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Int32, ByVal nCmdShow As Int32) As Int32
'event to hide
Dim tWnd As Int32 = apiFindWindow("Shell_TrayWnd", vbNullString)
Dim bWnd As Int32 = apiFindWindowEx(tWnd, bWnd, "BUTTON", vbNullString)
apiShowWindow(tWnd, 0)'to hide taskbar
apiShowWindow(bWnd, 0)'to hide startbutton
'event to unhide
Dim tWnd As Int32 = apiFindWindow("Shell_TrayWnd", vbNullString)
Dim bWnd As Int32 = apiFindWindowEx(tWnd, bWnd, "BUTTON", vbNullString)
apiShowWindow(tWnd, 1)'to unhide taskbar
apiShowWindow(bWnd, 1)'to unhide startbutton
Also you can make your form cover the whole screen(including taskbar) with this code:
Code:
Me.WindowState = FormWindowState.Maximized
-
Apr 16th, 2008, 05:35 AM
#2
Frenzied Member
Re: Hiding the taskbar
My start button didn't return, lol...
I had to restart, do you also know how to hide the side menu that pops up when you press "win" (Windows Logo)
Cheers
Icyculyr
-
Apr 16th, 2008, 06:57 AM
#3
Thread Starter
Hyperactive Member
Re: Hiding the taskbar
Hmmmm i just tried the exact code then and it worked make sure you have two different buttons, one to hide it and one to unhide it.
Well i'll look more into that but this is what i found:
Code:
Option Strict Off
Public Class Form1
Private Declare Auto Function SendMessage Lib "user32.dll" Alias "SendMessage" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As IntPtr
Private Declare Auto Function FindWindow Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Integer
Private Declare Auto Function GetDesktopWindow Lib "user32.dll" () As IntPtr
Const WM_SYSCOMMAND As Long = &H112
Const SC_CLOSE As Int32 = &HF060
Dim hwnd As Int32
Dim hwnd2 As Int32
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
Dim hDesktop = GetDesktopWindow()
MessageBox.Show(hDesktop)
Dim hTray = FindWindowEx(hDesktop, 0, "Shell_TrayWnd", Nothing)
MessageBox.Show(hTray)
Dim hReBar = FindWindowEx(hTray, 0, "ReBarWindow32", Nothing)
MessageBox.Show(hReBar)
Dim hTask = FindWindowEx(hReBar, 0, "MSTaskSwWClass", Nothing)
MessageBox.Show(hTask)
Dim hToolbar = FindWindowEx(hTask, 0, "ToolbarWindow32", Nothing)
MessageBox.Show(hToolbar)
SendMessage(hToolbar, WM_SYSCOMMAND, SC_CLOSE, Nothing)
'if you do the following it makes the menu black and opens up the shutdown menu WARNING! menu stays black!
SendMessage(hTray, WM_CLOSE, Nothing, Nothing)'i put this into a timer at 1000ms :S very hard to stop as it continuously came up, for some reason the closing event of this menu triggers the button press of the shutdown
'hmmm i'm contemplating whether or not to try the WM_DESTROY, who knows what will happen
End Sub
Now this totally wiped clean my taskbar... as in i don't see the applications in it and i dont know how to get them back without restarting but as i said before i'll do a bit of research.
Last edited by cameron2; Apr 16th, 2008 at 07:10 AM.
-
Apr 16th, 2008, 07:08 AM
#4
Thread Starter
Hyperactive Member
Re: Hiding the taskbar
I just had a thought, since a change in focus closes this menu why don't you detect the window keypress event and then change the focusa? This should cause the menu to close.
-
Apr 16th, 2008, 07:20 AM
#5
Thread Starter
Hyperactive Member
Re: Hiding the taskbar
Problem Solved:
Code:
Dim startmenu = FindWindow("DV2ControlHost", "Start Menu")
SendMessage(startmenu, WM_CLOSE, Nothing, Nothing)
-
Apr 16th, 2008, 07:37 PM
#6
Frenzied Member
-
Apr 17th, 2008, 07:05 AM
#7
Thread Starter
Hyperactive Member
Re: Hiding the taskbar
Oh btw thanks for making me look into this... this is great for my security app.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|