UID | title | description | helpviewer_keywords | old-location | tech.root | ms.assetid | ms.date | ms.keywords | req.header | req.include-header | req.target-type | req.target-min-winverclnt | req.target-min-winversvr | req.kmdf-ver | req.umdf-ver | req.ddi-compliance | req.unicode-ansi | req.idl | req.max-support | req.namespace | req.assembly | req.type-library | req.lib | req.dll | req.irql | targetos | req.typenames | req.redist | ms.custom | f1_keywords | dev_langs | topic_type | api_type | api_location | api_name | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NF:pdh.PdhConnectMachineA |
PdhConnectMachineA function (pdh.h) |
Connects to the specified computer. (ANSI) |
|
perf\pdhconnectmachine.htm |
perf |
8f8b4651-b550-4b34-bb2f-d2497c56b572 |
12/05/2018 |
PdhConnectMachine, PdhConnectMachine function [Perf], PdhConnectMachineA, PdhConnectMachineW, _win32_pdhconnectmachine, base.pdhconnectmachine, pdh/PdhConnectMachine, pdh/PdhConnectMachineA, pdh/PdhConnectMachineW, perf.pdhconnectmachine |
pdh.h |
Windows |
Windows XP [desktop apps only] |
Windows Server 2003 [desktop apps only] |
PdhConnectMachineW (Unicode) and PdhConnectMachineA (ANSI) |
Pdh.lib |
Pdh.dll |
Windows |
19H1 |
|
|
|
|
|
|
Connects to the specified computer.
Null-terminated string that specifies the name of the computer to connect to. If NULL, PDH connects to the local computer.
If the function succeeds, it returns ERROR_SUCCESS.
If the function fails, the return value is a system error code or a PDH error code. The following are possible values.
Return code | Description |
---|---|
|
Unable to connect to the specified computer. Could be caused by the computer not being on, not supporting PDH, not being connected to the network, or having the permissions set on the registry that prevent remote connections or remote performance monitoring by the user. |
|
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. |
Typically, applications do not call this function and instead the connection is made when the application adds the counter to the query.
However, you can use this function if you want to include more than the local computer in the Select counters from computer list on the Browse Counters dialog box. For details, see the PDH_BROWSE_DLG_CONFIG structure.
Note
The pdh.h header defines PdhConnectMachine as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.