Solved

how can i know the taskbar's height?

Posted on 2002-03-24
3
987 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
jbil earned 20 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

688 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