Kernel32AddDllDirectory Method

Adds a directory to the process DLL search path.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, 
	SetLastError = true)]
public static IntPtr AddDllDirectory(
	string newDirectory
)

Parameters

newDirectory  String
An absolute path to the directory to add to the search path. For example, to add the directory Dir2 to the process DLL search path, specify \Dir2.

Return Value

IntPtr
If the function succeeds, the return value is an opaque pointer that can be passed to RemoveDllDirectory(IntPtr) to remove the DLL from the process DLL search path.

If the function fails, the return value is Zero.

To get extended error information, call GetLastWin32Error.

Remarks

See Also