Thread: FFT3DFilter 2.6
View Single Post
Old 4th September 2017, 17:04   #26  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by TheFluff View Post
There's nothing that says the current directory is the plugins folder.
You're right, brain fart.

This would work to get the fully qualified path to the plugin when called from the plugin (I assume that's what you meant by "You can actually get a DLL's own path though using some other mildly exotic win32 API gymnastics"):

Code:
HMODULE GetCurrentModule()
{
 HMODULE hModule = NULL;
 GetModuleHandleEx(
  GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
  (LPCTSTR)GetCurrentModule,
  &hModule);

 return hModule;
}

HMODULE hm = GetCurrentModule();
char szPath[MAX_PATH + 1];
GetModuleFileName(hm, szPath, MAX_PATH);
Note: No error handling whatsoever in this code ;-)

Last edited by Groucho2004; 4th September 2017 at 17:55.
Groucho2004 is offline   Reply With Quote