Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

GetDesktopRect - Get size and position of available desktop area
[ All Languages » VB »  Windows]

Total Hit ( 3595)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
Private Type RECT
  Left As Long
  Top As Long
  Right As Long
  Bottom As Long
End Type
Private Const SPI_GETWORKAREA = 48

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

' Return information on screen's available area
' that is, the rectangle that isn't taken by any
' taskbar that is always visible
'
' the area size and posizion are returned in the first 4 arguments
' all values are in pixels, or in twips
' if the last argument is set to True
'
' Usage:
'  Dim le As Long, tp As Long, wi As Long, he As Long
'  GetDesktopRect le, tp, wi, he, True
'  MsgBox "Left=" & le & vbCr & "Top=" & tp & vbCr '   & "Width=" & wi &
' vbCr & "Height=" & he

Sub GetDesktopRectt(Left As Long, Top As Long, Width As Long, Height As Long, _
  Optional ReturnAsTwips As Boolean)
  Dim lpRect As RECT
  SystemParametersInfo SPI_GETWORKAREA, 0, lpRect, 0
  ' extract values
  Left = lpRect.Left
  Top = lpRect.Top
  Width = lpRect.Right - lpRect.Left
  Height = lpRect.Bottom - lpRect.Top
  ' convert to twips if requested
  If ReturnAsTwips Then
    Left = Left * Screen.TwipsPerPixelX
    Top = Top * Screen.TwipsPerPixelY
    Width = Width * Screen.TwipsPerPixelX
    Height = Height * Screen.TwipsPerPixelY
  End If
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.