TGC Codebase Backup



Desktop Mode Aspect Function by TinTin

7th Oct 2006 7:44
Summary

This function returns the desktop display mode. allows screen size to adjust to wide-screen monitors



Description

This function returns the desktop display mode. this will allow programs to adjust their screen resolutions to suit the correct monitor aspect, i.e. wide screen monitors.
The Width & Height values could also be used to center windows on the desktop.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Type tDMode
   hWnd,hDc,Width,Height,Depth as dWord
EndType

Global Display as tDMode

Function Get Desktop()
   Load Dll "User32.dll",1
   Load Dll "Gdi32.dll",2
   Display.hWnd   = Call dll(1,"GetDesktopWindow")
   Display.Width  = Call dll(1,"GetSystemMetrics",0) 
   Display.Height = Call dll(1,"GetSystemMetrics",1)
   Display.hDc    = Call dll(1,"GetDC",0)
   Display.Depth  = Call dll(2,"GetDeviceCaps",Display.hDc,12)
   Call dll 1,"ReleaseDC",0,Display.hDc
   Delete dll 2
   Delete dll 1 
EndFunction