Height and width of Desktop?
Blitz3D Forums/Blitz3D Programming/Height and width of Desktop?
| ||
It is possible somehow recover from within Blitz3D the width and height of the windows desktop?, The fact is that my application recognizes (Menu) all display modes available on the graphics card, but if the end user decides to execute the screen relosución highest screen mode application, it runs the RISG to overcome the current windows on the desktop and the field of view of the application is reduced. Then wanted to know if it is possible to recover the data (windows desktop width and height) to windows screen mode, taken as a maximum instead of pass that data. ![]() |
| ||
Yes. See here: http://www.blitzbasic.com/Community/posts.php?topic=21501 (...or just copy this code: ; User32.decls ; .lib "user32.dll" User32_GetSystemMetrics% (nIndex%) : "GetSystemMetrics" ; ;Blitz code Global DesktopWidth = User32_GetSystemMetrics(0) Global DesktopHeight = User32_GetSystemMetrics(1) ...) |
| ||
:D thanks!! i'am happy :) |
| ||
Thanks Yash, That's an interesting Function, GetSystemMetrics(#) ; sources: ; http://www.blitzbasic.com/Community/posts.php?topic=100455 ; http://msdn.microsoft.com/en-us/library/windows/desktop/ms724385%28v=vs.85%29.aspx I made this small demo showing various uses of GetSystemMetrics(#) ;------------------------------------------------------------------------ Next, is a simple demonstration of saving graphics modes in an array using the default B3D functions. ( These are apparently the FULL SCREEN modes. ) Type Gmode ; Create a listing of graphics modes Field x,y ; width, height Field d ; depth End Type Graphics 800,500,32,2 countModes=CountGfxModes() Dim Gr.Gmode( countModes ) Local gg.gmode For z= 1 To countModes gg = New Gmode gg\x = GfxModeWidth(z) gg\y = GfxModeHeight(z) gg\d = GfxModeDepth(z) Gr(z) = gg Next Print Print " There are " + countModes + " graphics modes available as shown: " Print For z= 1 To countModes ;; First, list all those with depth=16 If Gr(z)\d =16 Print" mode ="+z+" width ="+Gr(z)\x+ " height="+Gr(z)\y+" depth = 16 " End If Next Print For z= 1 To countModes ;; Next, list all those with depth=32 If Gr(z)\d =32 Print" mode ="+z+" width ="+Gr(z)\x+ " height="+Gr(z)\y+" depth = 32 " End If Next WaitKey():End My results show that my computer has 24 graphics modes, where all the even modes have depth=32, and all the odd modes have depth=16 ![]() |
| ||
My code.; Scaneo de Modos Gráfricos. ;_________________________ Function ScaneoModoVideo%() Local X% If Copia_WIND% = 0 Then For X% = 1 To CountGfxModes3D() If GfxModeDepth(X) = 16 Then BCF_AddComboBoxItem%(CMB_ModoVideo%,GfxModeWidth(X%) + " X " + GfxModeHeight(X%) + " -" + GfxModeDepth(X%) +"-",55,X%) End If Next For X% = 1 To CountGfxModes3D() If GfxModeDepth(X) = 32 Then BCF_AddComboBoxItem%(CMB_ModoVideo%,GfxModeWidth(X%) + " X " + GfxModeHeight(X%) + " -" + GfxModeDepth(X%) +"-",55,X%) End If Next End If If Copia_WIND% = 1 For X% = 1 To CountGfxModes3D() If GfxModeDepth(X) = 32 If GfxModeWidth(X) <= EscritorioAncho% And GfxModeHeight(X) <= EscritorioAlto% BCF_AddComboBoxItem%(CMB_ModoVideo%,GfxModeWidth(X%) + " X " + GfxModeHeight(X%) + " -" + GfxModeDepth(X%) +"-",55,X%) End If End If Next End If If InitGameFirst% = True Then BCF_SelectedComboBoxValue%(CMB_ModoVideo%,"800 X 600 -32-") Else If Copia_WIND% = 1 And GfxModeDepth(Copia_ModoVideo%) = 16 BCF_SelectedComboBoxType%(CMB_ModoVideo%,Copia_ModoVideo%+1) Copia_ModoVideo% = Copia_ModoVideo% +1 Else BCF_SelectedComboBoxType%(CMB_ModoVideo%,Copia_ModoVideo%) End If End If End Function |
| ||
Isn't there a command for that already (ie DesktopWidth() and DesktopHeight()) that gets the screen resolution??? |
| ||
re "Isn't there a command for that already .." We use the ones Yasha invented: ![]() I don't think Blitz3d has an equivalent command. Native_Monitor_X = User32_GetSystemMetrics(0) Native_Monitor_Y = User32_GetSystemMetrics(1) |
| ||
Hey hey don't give me credit for those, all I did was find the older forum post. Credit for those finds belongs to user "fredborg" (hasn't posted here in years but made some cool stuff back in the day). |