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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I remove the Taskbar via code 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have code that hides the Taskbar, however Access still sees where the taskbar was and doesn't open to the entire screen size. If I right click on the taskbar, go to properties, remove the check from the "always on top" checkbox and place a check in the "Auto Hide" checkbox, then Access thinks there is no taskbar and opens to the entire screen. I need to simulate that via code.
Any help would be greatly appreciated.

 
Enter this code in General Declarations section of your startup form:

Private Declare Function FindWindow Lib "user32" _ Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private 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

Const SWP_HIDEWINDOW = &H80
Const SWP_SHOWWINDOW = &H40

And this code in your forms OnOpen Event:

Dim lngVar as Long

'This will hide the taskbar
lngVar = FindWindow("Shell_traywnd", "")
Call SetWindowPos(rtn, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)

And finally, this code on your forms Unload Event:

Dim lngVar As Long

'This will show the task bar
lngVar = FindWindow("Shell_traywnd", "")
Call SetWindowPos(rtn, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)

Hope this works,
Shane
 
Sorry zygor,

replace any instance of rtn in the code with lngVar.

Shane
 
Shane,
I appreciate your help. The code you list is the same code I already have. When you ryn that code, the taskbar does disappear, but the Access window only goes down to where the taskbar was. Not to the bottom of the screen.
If you actually change the checks in the properties of the taskbar, then open access, the Access window will go all the way to the bottom of the screen.

Thanks
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top