GetWindowModuleFileName Function

The GetWindowModuleFileName function retrieves the full path and file name of the module associated with the specified window handle.

Syntax

UINT GetWindowModuleFileName(      
    HWND hwnd,     LPTSTR lpszFileName,     UINT cchFileNameMax );

Parameters

hwnd
[in] Handle to the window whose module file name will be retrieved.
lpszFileName
[out] Pointer to a buffer that receives the path and file name.
cchFileNameMax
[in] Specifies the maximum number of TCHARs that can be copied into the lpszFileName buffer.

Return Value

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

Remarks

Windows 95/98/Me: GetWindowModuleFileNameW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.

Function Information

Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systems Windows 95, Windows NT 4.0 SP3
UnicodeImplemented as ANSI and Unicode versions.

See Also

Windows Overview
Tags :


Community Content

milkyhash
GetWindowModuleFileName & GetModuleFileName Work Only with the Calling Process
It doesn't work for other processeses on Windows 2000, XP and Vista. See http://support.microsoft.com/?id=228469.

Page view tracker