GetDesktopRect – Get size and position of available desktop area

Private Type RECT    Left As Long    Top As Long    Right As Long    Bottom As LongEnd TypePrivate Const SPI_GETWORKAREA = 48Private 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=" & heSub 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 IfEnd Sub

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

technology leadership

Why the World Needs More Technology Leadership

As a fact, technology has touched every single aspect of our lives. And there are some technology giants in today’s world which have been frequently opined to have a strong influence on recent overall technological influence. Moreover, those tech giants have popular technology leaders leading the companies toward achieving greatness.

iOS app development

The Future of iOS App Development: Trends to Watch

When it launched in 2008, the Apple App Store only had 500 apps available. By the first quarter of 2022, the store had about 2.18 million iOS-exclusive apps. Average monthly app releases for the platform reached 34,000 in the first half of 2022, indicating rapid growth in iOS app development.

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job