Yet Another CenterForm Routine

Yet Another CenterForm Routine

In the April 1997 issue of VBPJ, you published a tip called “Consider the Taskbar When Centering Forms.” You can center forms more easily with the SystemParametersInfo API call:

 Private Declare Function _	SystemParametersInfo Lib "user32" Alias _	"SystemParametersInfoA" (ByVal uAction _	As Long, ByVal uParam As Long, R As Any, _	ByVal fuWinIni As Long) As LongPrivate Type RECT	Left As Long	Top As Long	Right As Long	Bottom As LongEnd TypePrivate Const SPI_GETWORKAREA = 48Public Sub CenterForm(frm As Form)	Dim R As RECT, lRes As Long, 	Dim lW As Long, lH As Long	lRes = SystemParametersInfo( _		SPI_GETWORKAREA, 0, R, 0)	If lRes Then		With R			.Left = Screen.TwipsPerPixelX * .Left			.Top = Screen.TwipsPerPixelY * .Top			.Right = Screen.TwipsPerPixelX * .Right			.Bottom = Screen.TwipsPerPixelY * .Bottom			lW = .Right - .Left			lH = .Bottom - .Top			frm.Move .Left + (lW - frm.Width)  2, _				.Top + (lH - frm.Height)  2		End With	End IfEnd Sub
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