Why does SPI_GETWORKAREA come in too large?

D

Die_Another_Day

This is a question for all of the MVP's out there. I use this code to
get the screen size and adjust my userform to fit. Can anyone explain
why I have to multiply the returned screen size by 0.75 in order for
things to line up correctly?

Thanks,

Die_Another_Day

Option Explicit

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


Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type


Sub SizeForm()
Dim nRect As RECT


SystemParametersInfo SPI_GETWORKAREA, 0, nRect, 0
With UserForm1
.Top = nRect.Top
.Left = nRect.Left
.Width = (nRect.Right - nRect.Left) * 0.75
.Height = (nRect.Bottom - nRect.Top) * 0.75
End With
UserForm1.Show


End Sub
 
D

Die_Another_Day

Thanks Tom! Keep smoking that good stuff you got over there!!

Die_Another_Day
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top