Share via


GetModuleFileName

A version of this page is also available for

Windows Embedded CE 6.0 R3

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, GetModuleFileName returns 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 lpFilename buffer.

    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