PdhConnectMachine

The PdhConnectMachine function connects to the specified machine, and creates and initializes a machine entry in the PDH DLL.

PDH_STATUS PdhConnectMachine(
  IN LPCTSTR szMachineName  // machine to browse
);
 

Parameters

szMachineName
The name of the machine to browse.

Return Values

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, the return value is a PDH error status defined in pdhmsg.h. The following are possible error values:

PDH_CSTATUS_NO_MACHINE
Unable to connect to the specified machine. Could be caused by the machine not being on, not running Windows NT, not being connected to the network, or having the permissions set on the registry to not allow remote connections or remote performance monitoring by the user.
PDH_MEMORY_ALLOCATION_FAILURE
Unable to allocate a dynamic memory block. Occurs when there is a serious memory shortage in the system due to too many applications running on the system or an insufficient memory paging file.

Remarks

An application can call PdhConnectMachine to establish a connection to a remote machine at a more convenient time than when the application opens a query and adds counters.

See Also

Performance Data Helper Overview, Performance Data Functions, , PdhEnumMachines