共用方式為


My.Computer.Registry.PerformanceData Property 

Returns a RegistryKey type, which provides access to HKEY_PERFORMANCE_DATA.

' Usage
Dim value As Microsoft.Win32.RegistryKey = My.Computer.Registry.PerformanceData
' Declaration
Public ReadOnly Property PerformanceData As Microsoft.Win32.RegistryKey

Return Value

RegistryKey

Remarks

HKEY_PERFORMANCE_DATA is used to access performance information for software components. Each software component creates keys for its objects and counters when it is installed and writes counter data while it is executing. This data is not stored in the registry, although the registry is used to access it. Instead, calling registry functions via HKEY_PERFORMANCE_DATA causes the system to collect the data from the appropriate system object managers.

This key does not exist on Windows 98 systems; an attempt to use it other than calling the Name method will throw an IOException.

This key cannot normally be written to; attempting to create a subkey on it will throw an IOException.

The RegistryPermission class, which is in the System.Security.Permissions namespace, controls access to registry variables. Registry variables should not be stored in memory locations where code without RegistryPermission can access them. Similarly, when granting permissions, grant the fewest privileges necessary to get the job done.

Registry permission access values are defined by the RegistryPermissionAccess enumeration. The following table details its members.

Value Description

AllAccess

Create, read, and write access to registry variables.

Create

Create access to registry variables.

NoAccess

No access to registry variables.

Read

Read access to registry variables.

Write

Write access to registry variables.

Tasks

The following table lists examples of tasks involving the My.Computer.Registry object.

To See

Create a registry key

How to: Create a Registry Key and Set Its Values in Visual Basic

Delete a registry key

How to: Delete a Registry Key in Visual Basic

Determine whether a value exists in a registry key

How to: Determine if a Value Exists in a Registry Key in Visual Basic

Read a value from a registry key

How to: Read a Value from a Registry Key in Visual Basic

Set a value in a registry key

How to: Set Values in Registry Keys in Visual Basic

Example

This example gets the value ThisSoftware from the MyCompany subkey.

My.Computer.Registry.PerformanceData.GetValue("MyCompany\ThisSoftware")

Requirements

Namespace: Microsoft.VisualBasic.MyServices

Class: RegistryProxy (provides access to Registry)

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

Availability by Project Type

Project type Available

Windows Application

Yes

Class Library

Yes

Console Application

Yes

Windows Control Library

Yes

Web Control Library

Yes

Windows Service

Yes

Web Site

Yes

Permissions

No permissions are required.

See Also

Tasks

Troubleshooting: Manipulating the Registry

Reference

My.Computer.Registry Object
Microsoft.Win32.RegistryKey
Microsoft.Win32.Registry.PerformanceData

Concepts

Common Registry Tasks
Security and the Registry
Reading from and Writing to the Registry Using My