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
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 Left = lpRect.Left Top = lpRect.Top Width = lpRect.Right - lpRect.Left Height = lpRect.Bottom - lpRect.Top If ReturnAsTwips Then Left = Left * Screen.TwipsPerPixelX Top = Top * Screen.TwipsPerPixelY Width = Width * Screen.TwipsPerPixelX Height = Height * Screen.TwipsPerPixelY End If End Sub |