How i can get Desktop size ?

Blitz3D Forums/Blitz3D Programming/How i can get Desktop size ?

How i can get Desktop size ? and bitdepth ?

; User32.decls
;
.lib "user32.dll"
User32_GetSystemMetrics% (nIndex%) : "GetSystemMetrics"

;
;Blitz code
Global DesktopWidth  = User32_GetSystemMetrics(0)
Global DesktopHeight = User32_GetSystemMetrics(1)

I think the desktop depth is index 2, not sure though.

Fredborg

Thx Fredborg :) but how i can use it ? i need external dll ?

It uses "user32.dll" that ships with any version of windows. You just need to copy and past
; User32.decls
;
.lib "user32.dll"
User32_GetSystemMetrics% (nIndex%) : "GetSystemMetrics"
in a .decls file (say "user32.decls") and to put it in your "Blitz3D\userlibs" directory. And then in blitz you can do
Global DesktopWidth  = User32_GetSystemMetrics(0)
Global DesktopHeight = User32_GetSystemMetrics(1)


No, User32.dll is a part of Windows, so you don't need anything special. Just put the first 4 lines in a file called "User32.decls" in the Blitz3D Userlibs folder. You might need to restart Blitz, then it should work.

Hehe, beat to it :)

Fredborg

Ok ok !!!! thx guys !

Any idea for the bit depth ?

Have you tried GraphicsDepth()?

http://www.blitzbasic.com/b3ddocs/command.php?name=GraphicsDepth&ref=2d_cat

With GetSystemMetrics you can get a lot more Information from Windows, see here:
http://msdn.microsoft.com/library/?url=/library/en-us/sysinfo/base/getsystemmetrics.asp