VB 6.0 - System Information Related Samples

Change the Screen Resolution
Change the screen resolution from VB using the EnumDisplaySettings and ChangeDisplaySettings APIs.

Code Based Timers
Create a code based timer that's more accurate with better resolution than VB's Timer control. The timer resides in an ActiveX DLL and doesn't need to be sited on a form. You can use it in applications that run unattended and that have no visual interface. Also make counting timers and timers that callback your app when they trigger.

Create Your Own Screen Saver or Start an Existing Screen Saver
Develop fancy screen savers with VB. Mine shows a number of animated images, called sprites, moving around the screen glancing off its edges and ricocheting off each other. The screen saver is fully customizable, allows password protection, and runs in the screen saver preview window.

Determining Memory Statistics and System Resources
Retrieve the current state of the system's memory using the GlobalMemoryStatus function. On Windows 9x machines you can determine the system resource values displayed in Explorer's Help About dialog by using the Resource Meter's Rsrc32.dll. Use this info to determine to if there are enough reources to safely start your application.

Disable Ctrl-Alt-Delete, Alt-Tab and Ctrl-Esc Key Sequences
Prevent users from rebooting a PC by telling Windows the screen saver is running. Stop Ctrl-Esc and the Windows key from displaying the Start Menu.

Shut Down/Restart Windows
Shut down and Restart Windows via the ExitWindowsEx API. On WinNT and Win2K you can shut down windows after giving your application sufficient privilege to do so.

System Metrics Information
The GetSystemMetrics function returns a wealth of information including the width and height of the screen, window, icon, border, caption, scroll bar elements and more.

System Parameters Information
The SystemParametersInfo function queries systemwide parameters and provides information about the mouse, keyboard, desktop, icons size, screen saver,... This example also demonstrates how to get the Window's version using GetVersionEx.

Add Your Application's Icon to the System Tray
Add your application's icon to the System Tray and respond to mouse events occurring on your system tray icon. Work with ActiveX components from the system tray. Normally this is not possible due to the way Windows handles Remote Procedure Calls.

Locale Aware Date Format
Get the Locale specific Date and Number formats. If your regional settings are set to German, the standard date looks like "dd.mm.yy". Convert to the proper date format based on the locale.

List and Change Window's Date Formats
Enumerate all Long and Short Date formats currently defined on your system. Create new ones and change them on the fly!

Synchronize Your System's Time With an NTP Server
Retrieve the time from a public Network Time Protocol (NTP) server via the Winsock control then use it set your PC's time.

Create a System DSN
Programmatically create a system Data Source Name.

About TheScarms
About TheScarms

Sample code
version info

If you use this code, please mention "www.TheScarms.com"

Email this page

© Copyright 2024 TheScarms
Goto top of page