Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

PdhSelectDataSource function

Displays a dialog window that prompts the user to specify the source of the performance data.


PDH_STATUS PdhSelectDataSource(
  _In_     HWND hWndOwner,
  _In_     DWORD dwFlags,
  _Out_    LPTSTR szDataSource,
  _Inout_  LPDWORD pcchBufferLength


hWndOwner [in]

Owner of the dialog window. This can be NULL if there is no owner (the desktop becomes the owner).

dwFlags [in]

Dialog boxes that will be displayed to prompt for the data source. This parameter can be one of the following values.


Display the file browser only. Set this flag when you want to prompt for the name and location of a log file only.


Display the data source selection dialog box. The dialog box lets the user select performance data from either a log file or a real-time source. If the user specified that data is to be collected from a log file, a file browser is displayed for the user to specify the name and location of the log file.


szDataSource [out]

Caller-allocated buffer that receives a null-terminated string that contains the name of a log file that the user selected. The log file name is truncated to the size of the buffer if the buffer is too small.

If the user selected a real time source, the buffer is empty.

pcchBufferLength [in, out]

Maximum size of the szDataSource buffer, in TCHARs.

Return value

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 codeDescription

The length of the buffer passed in the pcchBufferLength is not equal to the actual length of the szDataSource buffer.


A zero-length buffer was passed in the szDataSource parameter.



Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]







Unicode and ANSI names

PdhSelectDataSourceW (Unicode) and PdhSelectDataSourceA (ANSI)

See also




Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.