Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Why does SPI_GETWORKAREA come in too large?

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Why does SPI_GETWORKAREA come in too large?

It's discussed in general he

https://www.informit.com/articles/ar...&seqNum=2&rl=1

--
Regards,
Tom Ogilvy


"Die_Another_Day" wrote:

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Why does SPI_GETWORKAREA come in too large?

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

Die_Another_Day
"Tom Ogilvy" wrote in message
...
It's discussed in general he

https://www.informit.com/articles/ar...&seqNum=2&rl=1

--
Regards,
Tom Ogilvy


"Die_Another_Day" wrote:

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
LARGE Fesk Excel Worksheet Functions 4 November 8th 08 12:39 AM
LARGE 1, LARGE 2, LARGE 3, LARGE 4 jeel Excel Worksheet Functions 2 January 30th 08 06:05 AM
IF Function too Large Trying Hard Excel Discussion (Misc queries) 2 February 12th 06 02:01 AM
LARGE Denys[_2_] Excel Programming 6 July 20th 05 09:04 PM
Sub too large ronreggin Excel Programming 4 July 13th 05 05:40 AM


All times are GMT +1. The time now is 10:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"