GetWindowModuleFileNameW function (winuser.h)

Retrieves the full path and file name of the module associated with the specified window handle.

Syntax

UINT GetWindowModuleFileNameW(
  [in]  HWND   hwnd,
  [out] LPWSTR pszFileName,
  [in]  UINT   cchFileNameMax
);

Parameters

[in] hwnd

Type: HWND

A handle to the window whose module file name is to be retrieved.

[out] pszFileName

Type: LPTSTR

The path and file name.

[in] cchFileNameMax

Type: UINT

The maximum number of characters that can be copied into the lpszFileName buffer.

Return value

Type: UINT

The return value is the total number of characters copied into the buffer.

Remarks

Note

The winuser.h header defines GetWindowModuleFileName 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.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

Windows Overview