Solved

how can i know the taskbar's height?

Posted on 2002-03-24
3
976 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

Technology Partners: 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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

756 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