# GetModuleDir

int GetModuleDir (const void *moduleHandle, char directoryPathname[]);

## Purpose

Obtains the name of the directory of the specified DLL module.

You can use GetModuleDir if you distribute a DLL and its related files to multiple users who might place the files in different directories. If your DLL needs to access a file that is in the same directory as the DLL, you can use GetModuleDir and MakePathname to construct the full pathname.

If the moduleHandle you specify is zero, GetModuleDir returns the same result as GetProjectDir.

## Parameters

Input
Name | Type | Description
moduleHandle | const void * | Module handle of DLL. Use the default parameter, __CVIUserHInst, to specify the handle of the module that contains the call to GetModuleDir. You can use any valid Windows module handle. Use 0 to indicate the project or stand-alone executable (rather than a DLL). If you pass 0 for the moduleHandle, GetModuleDir obtains the directory of the executable.
Output
Name | Type | Description
directoryPathname | string | The buffer in which the module directory pathname is returned. directoryPathname must be at least MAX_PATHNAME_LEN bytes long.

## Return Value

Name | Type | Description
result | integer | The result of the call.
Code | Description
0 | Success.
-1 | Current project has no pathname; the project is untitled.
-2 | There is no current project.
-3 | Out of memory.
-4 | Operating system is unable to determine the module directory; moduleHandle is probably invalid.