Screen positioning

This is a discussion on Screen positioning within the basic.visual forums in Programming Languages category; I have 2 forms in an application that are both loaded at startup. Form 1 acts as a menu bar and sits at the top of the screen. It is positioned using the following: Me.Move 0, 0, Screen.Width, 800 The 2nd form acts as a status bar form and sits at teh bottom of the screen. It is positioned using the following: Me.Move 0, Screen.height - Me.height, Screen.Width The problem I have is that if teh taskbar is set to display all teh time, the staus bar form is hidden behind it. How can I get the position and size ...

Go Back   Application Development Forum > Programming Languages > basic.visual

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-21-2008, 05:10 AM
ats@jbex
Guest
 
Default Screen positioning

I have 2 forms in an application that are both loaded at startup. Form 1
acts as a menu bar and sits at the top of the screen. It is positioned
using the following:
Me.Move 0, 0, Screen.Width, 800

The 2nd form acts as a status bar form and sits at teh bottom of the
screen. It is positioned using the following:
Me.Move 0, Screen.height - Me.height, Screen.Width

The problem I have is that if teh taskbar is set to display all teh time,
the staus bar form is hidden behind it. How can I get the position and size
of the taskbar and use this to correctly position my form? I do not want to
use the sysinfo tool as it has problems under Vista.

TIA

--
ats@jbex

Those who died are justified, for wearing the badge, they're the chosen
whites
You justify those that died by wearing the badge, they're the chosen whites

Rage Against The Machine - Killing In The Name
Reply With Quote
  #2  
Old 08-21-2008, 06:17 AM
Mike Williams
Guest
 
Default Re: Screen positioning

On 21 Aug, 10:10, "ats@jbex" <al...@allenjones.NOSPAM.co.PLEASE.uk>
wrote:

> How can I get the position and size of the taskbar
> and use this to correctly position my form? I do
> not want to use the sysinfo tool as it has problems
> under Vista.


Paste the following into a VB Form containing a Command Button. Run
the project and click the button:

Mike

Option Explicit
Private Const SPI_GETWORKAREA = 48
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
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 Sub Command1_Click()
Dim myrect As RECT
Dim wide1 As Long, high1 As Long
Dim wide2 As Long, high2 As Long
Dim s1 As String
' get the total screen pixel area
wide1 = ScaleX(Screen.Width, vbTwips, vbPixels)
high1 = ScaleY(Screen.Height, vbTwips, vbPixels)
s1 = "Screen size is " & Format(wide1) & " x " _
& Format(high1) & " pixels." & vbCrLf
' get the "available" screen pixel area, not
' including taskbar and other similar bars
Call SystemParametersInfo(SPI_GETWORKAREA, 0&, myrect, 0&)
wide2 = myrect.Right - myrect.Left
high2 = myrect.Bottom - myrect.Top
s1 = s1 & "Available desktop area is " & Format(wide2) _
& " x " & Format(high2) & " pixels." _
& vbCrLf _
& "Top left corner of the available desktop " _
& "area is at " & myrect.Left & ", " & myrect.Top
MsgBox s1
End Sub



Reply With Quote
  #3  
Old 08-21-2008, 07:15 AM
ats@jbex
Guest
 
Default Re: Screen positioning

On Thu, 21 Aug 2008 03:17:47 -0700 (PDT), Mike Williams wrote:

> On 21 Aug, 10:10, "ats@jbex" <al...@allenjones.NOSPAM.co.PLEASE.uk>
> wrote:
>
>> How can I get the position and size of the taskbar
>> and use this to correctly position my form? I do
>> not want to use the sysinfo tool as it has problems
>> under Vista.

>
> Paste the following into a VB Form containing a Command Button. Run
> the project and click the button:
>
> Mike
>
> Option Explicit
> Private Const SPI_GETWORKAREA = 48
> Private Type RECT
> Left As Long
> Top As Long
> Right As Long
> Bottom As Long
> End Type
> 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 Sub Command1_Click()
> Dim myrect As RECT
> Dim wide1 As Long, high1 As Long
> Dim wide2 As Long, high2 As Long
> Dim s1 As String
> ' get the total screen pixel area
> wide1 = ScaleX(Screen.Width, vbTwips, vbPixels)
> high1 = ScaleY(Screen.Height, vbTwips, vbPixels)
> s1 = "Screen size is " & Format(wide1) & " x " _
> & Format(high1) & " pixels." & vbCrLf
> ' get the "available" screen pixel area, not
> ' including taskbar and other similar bars
> Call SystemParametersInfo(SPI_GETWORKAREA, 0&, myrect, 0&)
> wide2 = myrect.Right - myrect.Left
> high2 = myrect.Bottom - myrect.Top
> s1 = s1 & "Available desktop area is " & Format(wide2) _
> & " x " & Format(high2) & " pixels." _
> & vbCrLf _
> & "Top left corner of the available desktop " _
> & "area is at " & myrect.Left & ", " & myrect.Top
> MsgBox s1
> End Sub


Thanks for this Mike. It helped massively.
--
ats@jbex

Every year is the same
And I feel it again,
I'm a loser - no chance to win

The Who - I'm One
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 03:45 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.