Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I hide the windows task bar?

Status
Not open for further replies.

LW

Programmer
Oct 23, 2000
20
0
0
US
I am developing an application that needs to use all of the screen real estate. I also need to control the user's access to to any other application on the machine. Is there an API function I can use to turn off the visibility of the task bar, including the Start Button?
 
You can do everything you asked by manipulating the registry (as a general solution) or through several API calls (as a more specific solution) but your question is of a very general nature. By that I mean, you have posted questions in four lines that will require answers consisting of several hundred lines of code.

You are asking for a "magic bullet". If such a thing existed, nobody here would have a job.

Start out with the "easy" questions: How do I make a form fill the entire screen? then... How do I disable the Windows Key? then... How do I disable Task Switching? then... How do I disable Ctrl+Alt+Del? then... How do I prevent users from terminating my app? then... How do I re-enable all of those features when my app terminates? (All relate to app specific solutions.)

All of the preceding questions can be answered by clicking the "Advanced Search" tab at the forum level here at Tek-Tips. You will find all of the components of an answer to your questions but you must be responsible for combining them into a working solution.

We are all willing to help other programmers get over the little humps in their code but we are reluctant to write free custom software packages. I realize that you weren't asking for that, and I applaud your ambition, but I don't think you understood what you were asking for. In order to make the solution work as intended, it would require more than a four-line reply.

Start out by stating your intentions and a description of your application. It will make it easier for us to help you find the final solution.
VCA.gif

Alt255@Vorpalcom.Intranets.com

"If you can get people to ask the wrong questions, they'll never find the right answers."[tt]
Thomas Pynchon[/tt]

Perhaps the reverse is also true....
 
How about 2 APIs and help from Microsoft Knowledgebase Article ID: Q197585

There is no programmatic way to change the AutoHide property in Microsoft Windows. To size a Visual Basic form so that it fills the entire screen, including covering the taskbar if it is showing, you must explicitly set the height and width of the window.

Code for Form with one command button:
Code:
Private Sub Command1_Click()
Dim cx As Long
Dim cy As Long
Dim RetVal As Long

' Determine if screen is already maximized.
If Me.WindowState = vbMaximized Then
    ' Set window to normal size
    Me.WindowState = vbNormal
End If

' Get full screen width.
cx = GetSystemMetrics(SM_CXSCREEN)

' Get full screen height.
cy = GetSystemMetrics(SM_CYSCREEN)

' Call API to set new size of window.
RetVal = SetWindowPos(Me.hwnd, HWND_TOP, 0, 0, _
     cx, cy, SWP_SHOWWINDOW)
End Sub
And in a module:
Code:
Declare Function SetWindowPos Lib "user32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, _ 
ByVal cy As Long, ByVal wFlags As Long) As Long

Declare Function GetSystemMetrics Lib "user32" _
         (ByVal nIndex As Long) As Long

Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1
Public Const HWND_TOP = 0
Public Const SWP_SHOWWINDOW = &H40

Which still doesn't solve the problem of disallowing use of the other applications(i.e. Shift/Tab combo), but nevertheless 'hides' the taskbar and gives you the real estate...
Mark



 
'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Insert 2 CommandButtons to your form (named Command1 and Command2).
'When you will press the First button the Taskbar will Disappear.
'To show the TaskBar again press the second button.
'Insert this code to the module :

Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Const SWP_HIDEWINDOW = &H80
Public Const SWP_SHOWWINDOW = &H40

'Insert the following code to your form:

Private Sub Command1_Click()
hwnd1 = FindWindow("Shell_traywnd", "")
Call SetWindowPos(hwnd1, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
End Sub

Private Sub Command2_Click()
hwnd1 = FindWindow("Shell_traywnd", "")
Call SetWindowPos(hwnd1, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)
End Sub

Eric De Decker
vbg.be@vbgroup.nl

Licence And Copy Protection AxtiveX
Source CodeBook for the programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top