Solved

how can i know the taskbar's height?

Posted on 2002-03-24
3
954 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 20 total points
Comment Utility
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
Comment Utility
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
Comment Utility
thanks, both can work.

thanks all

cc
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now