devxlogo

Handling the SysInfo Control

Handling the SysInfo Control

You can use the SysInfo control, distributed with VB5 and VB6, to write applications that can sport the Windows logo and that can behave intelligently when a system setting changes. The control fires the DisplayChanged event when the screen resolution changes, and it fires the SysColorChange event when the user modifies one or more system colors in the Control Panel.

For example, when you have a maximized form and the user switches to a higher screen resolution, VB correctly resizes the form to occupy a larger screen area. However, when the user switches to a lower resolution, VB doesn’t resize the form accordingly. This code does the trick:

 Private Sub SysInfo1_DisplayChanged()	' If the form is maximized, restore it and	' maximize it again	With Me		If .WindowState = vbMaximized Then			.Visible = False			.WindowState = vbNormal			.WindowState = vbMaximized			.Visible = True		End If	End WithEnd Sub

For more information on this topic, look on VB’s Help file under “SysInfo.”

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist