Solved

setting desktop work area

Posted on 1998-09-01
11
770 Views
Last Modified: 2012-08-14
hi...in the SystemParametersInfo call there's a
parameter called "SPI_SETWORKAREA". its used to set the
usable desktop area not including the system tray.
i need a complete example of how i can use this to fit
my own needs. example must leave nothing to my feeble
imagination...thats why its worth 200 pts. thanks :)
0
Comment
Question by:mwam
  • 5
  • 4
  • 2
11 Comments
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1432452
'Put this is a module
Public Const SPI_SETWORKAREA = 47
Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type

Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long

'Use this
Dim n as long
Dim rct as RECT
'Fill RECT with coordinates
n=SystemParametersInfo(SPI_SETWORKAREA, 0, rct, 1)
0
 

Author Comment

by:mwam
ID: 1432453
must not be filling rectangle with coordinates correctly...this
is what i'm doing:

Dim n As Long
Dim rct As RECT
rct.Left = 100
rct.Top = 100
rct.Bottom = 700
rct.Right = 700
'Fill RECT with coordinates
n = SystemParametersInfo(SPI_SETWORKAREA, 0, rct, 1)

i get a compiler error...type mismatch on "rct"


0
 
LVL 14

Expert Comment

by:waty
ID: 1432454
you have to set the API as follow :

Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long

0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 8

Expert Comment

by:MikeP090797
ID: 1432455
waty, read my answer again please. Try changing the 3rd parameter in the declare to RECT
0
 

Author Comment

by:mwam
ID: 1432456
tried that..still doesn't work.
0
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 200 total points
ID: 1432457
Try this one, it works, tested it:

Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long
0
 

Author Comment

by:mwam
ID: 1432458
ahh....it works :)...at first didn't see that the declare was
different. ..thanks much
0
 
LVL 14

Expert Comment

by:waty
ID: 1432459
He, That's the delcaration I have given you, I had tested it and worked.

I have given the answer before MikeP.
0
 

Author Comment

by:mwam
ID: 1432460
i see. i guess you deserve some points...but don't know
what can be done now. look for my next question, it'll
have your name in the subject.....thanks :)
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1432461
My declaration is different
0
 

Author Comment

by:mwam
ID: 1432462
ok....anyone know where i can get an updated api32.txt ?
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question