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 to get the height of the taskbar

Status
Not open for further replies.

phunugus

Programmer
Dec 26, 2002
21
0
0
US
what i wanna do is place a form in the bottom right corner, but i need the taskbar's height first. api calls? im using dot net. thx
 
You can use the SystemParametersInfo with SPI_GETWORKAREA action to get the size and location of the work area not obscured by taskbar and other toolbars.

The following vb code positions the form at the bottom right corner of the screen (near the clock) before showing it.
___
[tt]
Option Explicit
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Const SPI_GETWORKAREA = 48
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Sub Form_Load()
Dim r As RECT
SystemParametersInfo SPI_GETWORKAREA, 0, r, 0
Left = r.Right * Screen.TwipsPerPixelX - Width
Top = r.Bottom * Screen.TwipsPerPixelX - Height
End Sub
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top