?
Solved

how can i know the taskbar's height?

Posted on 2002-03-24
3
Medium Priority
?
1,007 Views
Last Modified: 2008-02-01
hi experts,

when i set my form windowstate to maximized, my task bar will cove some part of the form, so i want to know the height of the taskbar in vb code, so that i can set the height of the form properly.
0
Comment
Question by:cc_2000_sg
3 Comments
 
LVL 3

Accepted Solution

by:
jbil earned 80 total points
ID: 6893249
Private Const SM_CYMAXIMIZED = 62

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

Private Sub Form_Load()
Dim screeny
screeny = GetSystemMetrics(SM_CYMAXIMIZED) * Screen.TwipsPerPixelY
Me.Left = 0
Me.Top = 0
Me.Height = screeny
End Sub
0
 
LVL 1

Expert Comment

by:Ryan_231
ID: 6893262
here's another way to get the work area of the desktop.
this takes into account that the taskbar may not
neccesarrily always be across the bottom of the screen.


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

Const SPI_GETWORKAREA = 48


Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Dim Work As RECT

Public Sub GetWorkArea()
     Call SystemParametersInfo(SPI_GETWORKAREA, 0, Work, 0)
End Sub


Private Sub Form_Load()
  Call GetWorkArea
  Me.Caption = Work.Top & " " & Work.Right & " " & Work.Bottom & " " & Work.Left
End Sub


Work will hold the left,right,top,bottom of the usable
screen space in pixels.
0
 

Author Comment

by:cc_2000_sg
ID: 6893366
thanks, both can work.

thanks all

cc
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question