/*
--------------------------------------------------------
Filename.....: video.cc
ClassName....: video
Purpose......: NonVisual object to hold the Computer's
color depth and video resolution.
Programmer...: Rick Miller http://www.treturn.com/dbase
Date.........: April 24, 2001.
Notes........: See Notes below.
Written for..: VdB 7.x and newer.
Rev. History.: February 10, 2005 - renamed all external functions.
January 01, 2005 - verify externs.
Dependencies.: None.
Calls........: see x_InitExterns method for API calls.
Called by....: Any.
Usage........: set procedure to video.cc additive
Example......: See Example below.
Sample.......: None.
--------------------------------------------------------
Example:
--------------------------------------------------------
oRef = new video()
oRef.inspect()
--------------------------------------------------------
Properties:
--------------------------------------------------------
color <int> number of colors for comparison purposes.
height <int> video height resolution in pixels.
text <char> text for display purposes.
width <int> video width resolution in pixels.
*/
//---------------------------------------------------------------//
// constructor.
//---------------------------------------------------------------//
class video of object custom
this.className = "video"
// protected methods.
protect x_InitExterns
class::x_InitExterns()
this.color = 0
this.height = RMM_GetSystemMetrics(1)
this.text = "0 Colors"
this.width = RMM_GetSystemMetrics(0)
class::get()
//------------------------------------------------------------//
// end of constructor - methods below.
//------------------------------------------------------------//
// retrieve color settings.
function Get
Local cText, nColors, nDc, nVal
nDc = RMM_GetDC(0)
nColors = RMM_GetDeviceCaps(nDc, 12)
RMM_ReleaseDC(0, nDc)
if ncolors > 24
cText = "32 bit True-Color"
nVal = 32000
elseif nColors >= 24
cText = "24 bit True-Color"
nVal = 24000
elseif nColors >= 16
cText = "16 bit Hi-Color"
nVal = 16000
elseif nColors >= 8
cText = "256 Colors"
nVal = 256
elseif nColors >= 4
cText = "16 Colors"
nVal = 16
else
cText = "0 Colors"
nVal = 0
endif
this.color := nVal
this.text := cText
return
//------------------------------------------------------------//
function inspect
inspect(this)
return
//------------------------------------------------------------//
// initialize externs.
function x_InitExterns
if not type("RMM_GetDeviceCaps") == "FP"
extern CINT RMM_GetDeviceCaps(CHANDLE, CINT) ;
gdi32 from "GetDeviceCaps"
endif
if not type("RMM_ReleaseDC") == "FP"
extern CINT RMM_ReleaseDC(CHANDLE, CHANDLE) ;
user32 from "ReleaseDC"
endif
if not type("RMM_GetDC") == "FP"
extern CHANDLE RMM_GetDC(CHANDLE) ;
user32 from "GetDC"
endif
if not type("RMM_GetSystemMetrics") == "FP"
extern CINT RMM_GetSystemMetrics(CINT) ;
user32 from "GetSystemMetrics"
endif
return
//------------------------------------------------------------//
// release object from memory.
function Release
try
release object this
catch(exception e)
endtry
return
endclass
//---------------------------------------------------------------//
// end of video.
//---------------------------------------------------------------//