•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 456,553 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,460 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 2198 | Replies: 5
![]() |
•
•
Join Date: Nov 2005
Location: Montreal, QC (Almost)
Posts: 130
Reputation:
Rep Power: 4
Solved Threads: 9
Hi,
I have a form of variable height. When the form grows in height I have code that verifies if the bottom of the form will come below the bottom of the screen and, if so, moves the form up - no problem until here.
However, some of my users have taskbars that are two lines in height and my code only deals with sinlge-line taskbars by moving the form 450 twips further up (hardcoded is bad - I know). I would like to be able to tell how high the taskbar is and then move the form accordingly.
Here's my current code:
So my question is - is there a way of getting the taskbar height in VB?
Could somebody try to point me in the correct direction? Even if it is only "You can't get the taskbar height in VB." as answer that's great for me.
Thanks
Yomet
I have a form of variable height. When the form grows in height I have code that verifies if the bottom of the form will come below the bottom of the screen and, if so, moves the form up - no problem until here.
However, some of my users have taskbars that are two lines in height and my code only deals with sinlge-line taskbars by moving the form 450 twips further up (hardcoded is bad - I know). I would like to be able to tell how high the taskbar is and then move the form accordingly.
Here's my current code:
Private Sub cmdGrowForm_Click()
Dim NewH As Integer
Dim TBarH As Integer
TBarH = 450 'Assumes a single row taskbar
NewH = 11010 'New form height
If Me.Top + NewH + TBarH > Screen.Height Then
Me.Top = Screen.Height - NewH - TBarH
End If
Me.Height = NewH
End SubSo my question is - is there a way of getting the taskbar height in VB?
Could somebody try to point me in the correct direction? Even if it is only "You can't get the taskbar height in VB." as answer that's great for me.
Thanks
Yomet
•
•
Join Date: Nov 2006
Posts: 30
Reputation:
Rep Power: 2
Solved Threads: 4
Using the following API function you can get it!!
Private Const ABM_GETTASKBARPOS = &H5
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type APPBARDATA
cbSize As Long
hwnd As Long
uCallbackMessage As Long
uEdge As Long
rc As RECT
lParam As Long
End Type
Private Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long
Function GetTaskBarSize()
Dim ABD As APPBARDATA
SHAppBarMessage ABM_GETTASKBARPOS, ABD
MsgBox "Width:" & ABD.rc.Right - ABD.rc.Left
MsgBox " Height:" & ABD.rc.Bottom - ABD.rc.Top
End Sub www.easyprograming.com
Make Your Programing Easy
Make Your Programing Easy
•
•
•
•
Using the following API function you can get it!!
Private Const ABM_GETTASKBARPOS = &H5 Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Type APPBARDATA cbSize As Long hwnd As Long uCallbackMessage As Long uEdge As Long rc As RECT lParam As Long End Type Private Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long Function GetTaskBarSize() Dim ABD As APPBARDATA SHAppBarMessage ABM_GETTASKBARPOS, ABD MsgBox "Width:" & ABD.rc.Right - ABD.rc.Left MsgBox " Height:" & ABD.rc.Bottom - ABD.rc.Top End Sub
Hey, that's pretty nifty!
Hoppy
•
•
Join Date: Nov 2005
Location: Montreal, QC (Almost)
Posts: 130
Reputation:
Rep Power: 4
Solved Threads: 9
![]() |
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Help... (JavaScript / DHTML / AJAX)
- Making a Fullscreen form and hiding the Windows Taskbar (Pascal and Delphi)
- Strange Taskbar Behaviour!!!! (Windows NT / 2000 / XP / 2003)
- the 2 little computers do not show on the taskbar, connection issue (Windows NT / 2000 / XP / 2003)
- Customize the Taskbar (Windows tips 'n' tweaks)
- Move Your Taskbar to a New Spot (Windows tips 'n' tweaks)
- how to remove the system volume icon from taskbar (Windows NT / 2000 / XP / 2003)
- WinXP taskbar freezes / Active Desktop Recovery appears (Windows NT / 2000 / XP / 2003)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Retrieving form name
- Next Thread: How to export CRYSTAL REPORT to PDF format.


Linear Mode