A continuación se muestran las funciones capaces de devolver este valor. Nota: En la version de FoxPro de Windows se debe cargar FOXTOOLS.FLL antes de llamar a la función.
FUNCTION NumColors * version de 32 bit para uso con * VFP bajo Win 95 y superiores, * y Windows NT 3.51 y superiores DECLARE INTEGER GetDC IN Win32API; INTEGER hWnd DECLARE INTEGER GetDeviceCaps IN Win32API; INTEGER hDC, INTEGER nIndex DECLARE INTEGER ReleaseDC IN Win32API; INTEGER hWnd, INTEGER hDC LOCAL lnresult, lnhDC, lnplanes, lnpixels lnresult = 0 lnhDC = GetDC(0) IF lnhDC > 0 * Get the number of color planes lnplanes = GetDeviceCaps(lnhDC, 14) * Get the number of bits per pixel lnpixels = GetDeviceCaps(lnhDC, 12) * Calculate the return value lnresult = 2 ^ (lnplanes * lnpixels) = ReleaseDC(0, lnhDC) ENDIF RETURN lnresult
FUNCTION NumColors
* Para usar con FPW 2.5 y superiores
* y VFP bajo Windows 3.1
PRIVATE m.result, m.getdc, m.getdevcaps,;
m.releasedc, m.hdc, m.planes, m.pixels
m.result = 0
m.getdc = RegFN('GetDC', 'I', 'I')
m.getdevcaps = RegFN('GetDeviceCaps', 'II', 'I')
m.releasedc = RegFN('ReleaseDC', 'II', 'I')
m.hdc = CallFN(m.getdc, 0)
IF m.hdc > 0
* Get the number of color planes
m.planes = CallFN(m.getdevcaps, m.hdc, 14)
* Get the number of bits per pixel
m.pixels = CallFN(m.getdevcaps, m.hdc, 12)
* Calculate the return value
m.result = 2 ^ (m.planes * m.pixels)
= CallFN(m.releasedc, 0, m.hdc)
ENDIF
RETURN m.result
No hay comentarios. :
Publicar un comentario
Los comentarios son moderados, por lo que pueden demorar varias horas para su publicación.