Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
16 colors - 256 colors - how to determine?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00109377
Message ID:
00132273
Views:
26
Don't you want to make this a FAQ? Thanks.

Vlad

>You have to use the API. Here's a function that will do it:
>FUNCTION NumColors
>
>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
>  lnplanes = GetDeviceCaps(lnhDC, 14) && 14 is the number of planes
>  lnpixels = GetDeviceCaps(lnhDC, 12) && 12 is the bits per pixel
>  lnresult = 2 ^ (lnplanes * lnpixels)
>  = ReleaseDC(0, lnhDC)
>ENDIF
>RETURN lnresult
>hth,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform