Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to detect screen resolution?
Message
De
09/12/1997 22:39:42
Christopher Holtz
Integral Computer Services, Inc.
Rochester, New York, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00064843
Message ID:
00064873
Vues:
31
>Regarding the code to determine the number of colors available, is that available in the files? I would be interested in obtaining this information also. Thank you.
>Marcus.
>
>>I just copied the great code by George Tasker which determines the number of colors
>>available. Along those same lines... is there any way to tell which resolution setting
>>is in effect (640 x 480, 1024 x 768, ...)?
>>
>>thanks in advance

I copied this to a txt file when it was posted. Enjoy.
- Chris Holtz


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

* Next, get a valid (greater than zero) device context
lnhDC = GetDC(0)

* Get the number of planes
lnplanes = GetDeviceCaps(lnhDC, 14)

*Get the bits per pixel
lnpixels = GetDeviceCaps(lnhDC, 12)

*Calculate the number of colors
lnnumclrs = 2 ^ (lnplanes * lnpixels)

*Finally, release the device context
= ReleaseDC(0, lnhDC)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform