Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Screen color resolution
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00106531
Message ID:
00106672
Vues:
33
>Is there a fonction that determines the number of color the user has on his desktop? That way, I would use the best Wallpaper bitmap possible based on the resolution. (16, 256 or 65000 colors).
>
>Thanks
Mario,

Here's pure FoxPro code to determine the number of colors.
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
ENDFUNC
hth,
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform