Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get Windows desktop resolution ?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00465547
Message ID:
00465595
Views:
24
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
Previous
Reply
Map
View

Click here to load this message in the networking platform