Determine the Correct Screen Dimensions

Determine the Correct Screen Dimensions

The latest video drivers can change the display resolution without rebooting. Unfortunately, the Screen object doesn’t always properly return the new display size; it only remembers the display size when the app first used it. This behavior appears to be driver-dependent, although it might be produced by the operating system (it occurs on my Windows NT machine but not on my Windows 98 system). If you need to determine screen dimensions at any time other than the Form_Load event, use the Windows API rather than the Screen object:

 Private Type RECT	Left As Long	Top As Long	Right As Long	Bottom As LongEnd TypePrivate Declare Function GetDesktopWindow Lib _	"user32" Alias "GetDesktopWindow" () As LongPrivate Declare Function GetWindowRect Lib _	"user32" Alias "GetWindowRect" (ByVal hwnd _	As Long, lpRect As RECT) As LongPublic Function ScreenWidth() As Single	Dim R As RECT	GetWindowRect GetDesktopWindow(), R	ScreenWidth = R.Right * Screen.TwipsPerPixelXEnd FunctionPublic Function ScreenHeight() As Single	Dim R As RECT	GetWindowRect GetDesktopWindow(), R	ScreenHeight = R.Bottom * Screen.TwipsPerPixelYEnd Function
Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved