|
-
Dec 20th, 2001, 02:38 PM
#1
Why not just turn the task bar off completely?
VB Code:
Private Const SWP_HIDEWINDOW = &H80
Private Const SWP_SHOWWINDOW = &H40
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
Private Sub Form_Load()
'make it go away
Dim Thwnd As Long
Thwnd = FindWindow("Shell_traywnd", "")
Call SetWindowPos(Thwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'make it come back
Dim Thwnd As Long
Thwnd = FindWindow("Shell_traywnd", "")
Call SetWindowPos(Thwnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)
End Sub
-
Dec 20th, 2001, 02:59 PM
#2
Thank you for your quick response. The problem is that it needs to float above the task bar not just sit at the bottom right of the screen. Taking away the task bar would not be the way to go for my app.
-
Dec 20th, 2001, 03:33 PM
#3
Have you tried searching on this topic? It seems to me that I remember a post a couple of months ago that asked about this same issue.
-
Dec 20th, 2001, 05:16 PM
#4
There have been numerouse questions asked about the height of
the taskbar. But my problem is slightly different.
If I use either SystemParametersInfo or SHAppBarMessage the
task bar height is always going to be the same. My resolution is
set to 1024 x 768. I derive the taskbar height from the rect type
that those functions return. Now here is the catch; They will
always return the same top value regardless if the taskbar is
currently hidden or not. In my case it always returns 715.
This is how the app needs to perform for someone who has auto
hide enabled:
The task bar is visible: The 715 value is no problem here
and the app sits on top of the taskbar.
The user moves thier mouse to the top of the screen and the
taskbar hides itself: now if I was to use the 715 value that is
always returned there would be a gap between the form and the
bottom of the screen.
The application needs to know if the taskbar is hidden at that
moment
Ok, actually SystemParametersInfo returns the entire screen
coordinates if the taskbar is set to AutoHide. But again it is
always the same value regardless of wether the taskBar is visible
or not.
-
Dec 21st, 2001, 06:31 AM
#5
Fanatic Member
Try GetWindowRect
Teaudirenopossum.Musasapientumfixaestinaure.
(I can't hear you. There's a banana in my ear)
-
Dec 21st, 2001, 02:22 PM
#6
Thank You! I Got it to work using SHAppBarMessage and GetWindowRect.
Here is the code for the module if anyone else needs it or is just
curiouse
VB Code:
Option Explicit
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Type APPBARDATA
cbSize As Long
hwnd As Long
uCallbackMessage As Long
uEdge As Long
rc As RECT
lParam As Long
End Type
Public Const ABM_GETSTATE = &H4
Public Const ABM_GETAUTOHIDEBAR = &H7
Public Const ABM_GETTASKBARPOS = &H5
Public Const ABS_ALWAYSONTOP = &H2
Public Const ABE_LEFT = 0
Public Const ABE_TOP = 1
Public Const ABE_RIGHT = 2
Public Const ABE_BOTTOM = 3
Public Declare Function SHAppBarMessage Lib "shell32.dll" _
(ByVal dwMessage As Long, _
pData As APPBARDATA) As Long
Public Declare Function GetWindowRect Lib "user32" _
(ByVal hwnd As Long, _
lpRect As RECT) As Long
Public Function GetTaskBarRect() As RECT
Dim state As Long
Dim position As Integer, hWndAppBar As Long
Dim myrect As RECT
Dim ABD As APPBARDATA
ABD.cbSize = Len(ABD)
state = SHAppBarMessage(ABM_GETSTATE, ABD)
If (state = False) Or (state = ABS_ALWAYSONTOP) Then
'TaskBar is not set to auto hide
'so no extra work needs to be done
SHAppBarMessage ABM_GETTASKBARPOS, ABD
GetTaskBarRect = ABD.rc
Else
'TaskBar is set to auto hide
'Find location
For position = ABE_LEFT To ABE_BOTTOM
ABD.uEdge = position
hWndAppBar = SHAppBarMessage(ABM_GETAUTOHIDEBAR, ABD)
If hWndAppBar > 0 Then
'Location found
'Now get Rect for its current position
'Thank You PsychoMark !!!
GetWindowRect hWndAppBar, myrect
GetTaskBarRect = myrect
Exit For
End If
Next position
End If
End Function
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
|