User 32 - Workspace Size

Blitz3D Forums/Blitz3D Programming/User 32 - Workspace Size

boomboom(Posted 2007) [#1]
Hi, I am using window mode 2 for my current project, and making it the size of the desktop by using the the User32 userlib command:

api_GetSystemMetrics(SM_CXSCREEN)

which is all fine, works great and returns a nice int of the screen width.

The trouble I am having is with the height, as it returns the total desktop height, not taking into consideration the start bar height (so it gets covered over, which I don't want).

What I am after seems to be the SPI_GETWORKAREA command, which works out the desktop size and automatically takes away any size taken up by the start bar. Unfortunately I don't know how to use this as it seems to return a custom variable that then needs processing to find the width.

I am not really too sure on this, here are some links that someone with more knowledge of such things could decipher:

http://www.tech-archive.net/Archive/VC/microsoft.public.vc.mfc/2007-08/msg01786.html
http://lists.trolltech.com/qt-interest/2000-01/thread00432-0.html
http://support.microsoft.com/kb/q154823/

and, of course, the user32 userlib in the code archives:

http://www.blitzbasic.com/codearcs/codearcs.php?code=1179


Kev(Posted 2007) [#2]
Hi

without much time to code this up, here what you would need to do. this is untested.

when calling SystemParametersInfo() with SPI_GETWORKAREA the pvParam must point to a RECT struct. so in blitz we could pass a bank as the pvParam param. this will return the coordinates of the working area into the bank now work out the size from the data in the bank.

it would look somthing like this.

bank = CreateBank(16)
user32_SystemParametersInfo(SPI_GETWORKAREA,0,bank,0)

the decls for it would be like this.
user32_SystemParametersInfo%(uAction%,uParam%,lpvParam*,fuWinIni%):"SystemParametersInfoA"

the desktop size would be somthing like PeekInt(bank,8)+Peekint(bank,12)

kev


boomboom(Posted 2007) [#3]
Thanks, I am working on it. What I would like to know is how do you know what value SPI_GETWORKAREA is?

Don't I need to set it before hand, something like SPI_GETWORKAREA = 12, otherwise I am just sending an empty variable?

And if I do need to set it, how to I know what int value SPI_GETWORKAREA should be?


Kev(Posted 2007) [#4]
this is correct chris.

Const SPI_GETWORKAREA = 48

kev


boomboom(Posted 2007) [#5]
how do you know these? This is what has confused me using the user32 stuff. Is there a list somewhere? The MSDN seems empty of numbers.


Kev(Posted 2007) [#6]
this is great to find out what values should be set when calling the api. it also shows how to define the .decls values and what .dll there located in.

http://www.activevb.de/rubriken/apiviewer/index-apiviewereng.html