共用方式為


Display System Information

File: ...\Samples\Solution\OLE\Sysinfo.scx

This sample illustrates using the SysInfoControl to display system information and to notify when a system setting changes.

The bulk of the code in this sample is in the CheckStatus method. Code in this method checks the settings of various SysInfoControl properties to see their current settings, and populates a treeview control with this information. For example, the following section of code checks the BatteryLifePercent setting:

IF ThisForm.SysInfo.BatteryLifePercent = 255
   * Add a node to display the information
ENDIF

When a system setting changes, an event of the SysInfoControl occurs. Code associated with each of these events sets the caption of a label and calls the CheckStatus method to refresh the treeview control. For example, the following code is associated with the SysColorsChanged event:

ThisForm.Status.Caption = SysColorsChanged_LOC
ThisForm.CheckStatus

See Also

Add and Remove Items in a Treeview Control | Solutions Samples | Visual FoxPro Foundation Classes A-Z