How i can get Desktop size ?

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

Filax(Posted 2003) [#1]
How i can get Desktop size ? and bitdepth ?


fredborg(Posted 2003) [#2]
; 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


Filax(Posted 2003) [#3]
Thx Fredborg :) but how i can use it ? i need external dll ?


Koriolis(Posted 2003) [#4]
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)



fredborg(Posted 2003) [#5]
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


Filax(Posted 2003) [#6]
Ok ok !!!! thx guys !


Filax(Posted 2005) [#7]
Any idea for the bit depth ?


JoeGr(Posted 2005) [#8]
Have you tried GraphicsDepth()?

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


jfk EO-11110(Posted 2005) [#9]
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