D
David
Hi,
I'm trying to use SystemParametersInfo to get the desktop work area:
Private Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer,
ByRef lpvParam As Integer, ByVal fuWinIni As Integer) As Integer
Dim rc As Rectangle
SystemParametersInfo(SPI_GETWORKAREA, 0, VarPtr(rc), 0)
but it returns the parameters in the "wrong" order, eg:
{System.Drawing.Rectangle}
Bottom: 1280
Empty: {System.Drawing.Rectangle}
Height: 0
IsEmpty: False
Left: 0
Location: {System.Drawing.Point}
Right: 994
Size: {System.Drawing.Size}
Top: 1280
Width: 994
X: 0
Y: 1280
where bottom should be 994 and right should be 1280. (I'm using the VarPtr
function that is around on the net, GCHandle etc).
If I redeclare SystemParametersInfo as:
Private Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer,
ByRef lpvParam As Rectangle, ByVal fuWinIni As Integer) As Integer
and say
SystemParametersInfo(SPI_GETWORKAREA, 0, rc, 0)
then the rc structure is populated correctly:
{System.Drawing.Rectangle}
Bottom: 994
Empty: {System.Drawing.Rectangle}
Height: 994
IsEmpty: False
Left: 0
Location: {System.Drawing.Point}
Right: 1280
Size: {System.Drawing.Size}
Top: 0
Width: 1280
X: 0
Y: 0
Two questions:
1) Why is there a difference between the two methods? I want to use the
first method if possible.
2) Is the second method a valid way of doing things, ie is it ok to have
multiple declarations?
Thanks.
David.
I'm trying to use SystemParametersInfo to get the desktop work area:
Private Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer,
ByRef lpvParam As Integer, ByVal fuWinIni As Integer) As Integer
Dim rc As Rectangle
SystemParametersInfo(SPI_GETWORKAREA, 0, VarPtr(rc), 0)
but it returns the parameters in the "wrong" order, eg:
{System.Drawing.Rectangle}
Bottom: 1280
Empty: {System.Drawing.Rectangle}
Height: 0
IsEmpty: False
Left: 0
Location: {System.Drawing.Point}
Right: 994
Size: {System.Drawing.Size}
Top: 1280
Width: 994
X: 0
Y: 1280
where bottom should be 994 and right should be 1280. (I'm using the VarPtr
function that is around on the net, GCHandle etc).
If I redeclare SystemParametersInfo as:
Private Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer,
ByRef lpvParam As Rectangle, ByVal fuWinIni As Integer) As Integer
and say
SystemParametersInfo(SPI_GETWORKAREA, 0, rc, 0)
then the rc structure is populated correctly:
{System.Drawing.Rectangle}
Bottom: 994
Empty: {System.Drawing.Rectangle}
Height: 994
IsEmpty: False
Left: 0
Location: {System.Drawing.Point}
Right: 1280
Size: {System.Drawing.Size}
Top: 0
Width: 1280
X: 0
Y: 0
Two questions:
1) Why is there a difference between the two methods? I want to use the
first method if possible.
2) Is the second method a valid way of doing things, ie is it ok to have
multiple declarations?
Thanks.
David.