Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function gets a module file name.

Syntax

WINAPI DWORD GetModuleFileName(
  HMODULE 
hModule,
  LPWSTR 
lpFilename,
  DWORD 
nSize
);

Parameters

hModule

[in] Handle to the module whose executable file name is being requested.

If this parameter is NULL, GetModuleFileNamereturns the path for the file used to create the calling process.

lpFilename

[out] Pointer to a buffer that is filled in with the path and file name of the module.

nSize

[in] Specifies the length, in characters, of the lpFilenamebuffer.

If the length of the path and file name exceeds this limit, the string is truncated.

Return Value

The length, in characters, of the string copied to the buffer indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

In Windows Embedded CE, a DLL is loaded from only one location by the system. All DLLs are stripped of their extension before being compared with the loaded module list. This means that Mydll.dll and Mydll.cpl are the same name and only one can be loaded.

Requirements

Header winbase.h
Library coredll.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

DLL Functions