Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get Windows desktop resolution ?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00465547
Message ID:
00465595
Vues:
25
Just as a side note, a metric that is not exposed through the VFP function is the colour depth. This is useful for displaying "colour depth friendly" bitmaps in things such as splash screens and just adds a bit of polish to applications. I only mention this because I always look at the screen metrics in terms of X, Y and Z (Z being colour depth).
declare integer FindWindow in win32api integer lvNotUsed, string lcWindowName
declare integer GetDC in win32api integer lnHwnd
declare integer GetDeviceCaps in win32api integer hDC, integer lnFlag

#define BITSPIXEL 12 

LOCAL lvVFPHwnd
LOCAL lvHDC
LOCAL lnColours


*!* Get application WIN32 handle.
lvVFPHwnd = FindWindow(0, _SCREEN.Caption)

*!* Get a handle to the applcations display context.
lvHDC = GetDC(lvVFPHwnd)

*!* Calculate the number of colours available to use.
lnColours = GetDeviceCaps(lvHDC, BITSPIXEL)

do case
   case lnColours = 4		&& 4bpp = 16 colours.
		
   case lnColours = 8		&& 8bpp = 256 colours.
		
   case lnColours = 16		&& 16bpp = 16k colours.
		
   case lnColours = 24		&& 24bpp = True colour.
		
   case lnColours = 32          && 32bpp = 24 + Alpha Channel
endcase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform