Article ID: 140488
Article Last Modified on 3/14/2005
2^(PLANES * BITSPIXEL)
* -- 3.0/5.0a/6.0 Code begins here
DECLARE INTEGER GetDC IN WIN32API INTEGER piGetDC
iDCHandle = GetDC(0)
*-- The following are the constants used by GetDeviceCaps
*-- Additional values can be found in C++ and the MSDN compact disc.
PLANES = 14
BITSPIXEL = 12
DECLARE INTEGER GetDeviceCaps IN WIN32API INTEGER piDCHandle, ;
INTEGER piNumColors
iPlanes=GetDeviceCaps(iDCHandle, PLANES)
iBitsPixel=GetDeviceCaps(iDCHandle,BITSPIXEL)
*-- Returns the number of colors used by the driver
iNumColors = 2^(iPlanes * iBitsPixel)
WAIT WINDOW "Number of colors this driver supports is " ;
+ALLTRIM(STR(iNumColors))
*-- The following code releases the GetDC handle
DECLARE INTEGER ReleaseDC IN Win32API INTEGER piHandle, ;
INTEGER piDCHandle
=ReleaseDC(0,iDCHandle)
*-- 3.0/5.0a/6.0 Code ends here
*-- Code begins here
SET LIBRARY TO SYS(2004)+"FOXTOOLS.FLL" ADDITIVE
*-- Gets a Device Context to the video driver. Zero is
*-- used to get the DC for the screen
iGetDC = RegFN("GetDC","I","I")
iDCHandle = CallFN(iGetDC,0)
*-- The following are the constants used by GetDeviceCaps
*-- Additional values can be found in C++ and the MSDN compact disc.
PLANES = 14
BITSPIXEL = 12
iGetDevCaps = RegFN("GetDeviceCaps","II","I")
iPlanes=CallFN(iGetDevCaps,iDCHandle, PLANES)
iBitsPixel=CallFN(iGetDevCaps,iDCHandle,BITSPIXEL)
*-- Returns the number of colors used by the driver
iNumColors = 2^(iPlanes * iBitsPixel)
WAIT WINDOW "Number of colors this driver supports is ";
+ALLTRIM(STR(iNumColors))
*-- The following code releases the GetDC handle
iReleaseDC = RegFN("ReleaseDC","II","I")
=CallFN(iReleaseDC,0,iDCHandle)
RELEASE LIBRARY SYS(2004)+"FOXTOOLS.FLL"
*-- Code ends here
This code was designed to work under all Windows platforms supported by
Microsoft FoxPro.
Additional query words: VFoxWin
Keywords: kbhowto kbcode KB140488