Working Directory

I wrote a header file which loads a DLL. I want to load the DLL from the directory of the executable, but whenever it searches for the DLL it just searches it's own directory. How do I get the directory of the executable at run-time?
I don't get it.
I want to load the DLL from the directory of the executable, but whenever it searches for the DLL it just searches it's own directory.
It sounds like it's doing exactly what you want.
Assuming you're on Windows (mentioned DLLs): GetModuleFileName

1
2
3
4
5
6
TCHAR app_path[MAX_PATH];
::GetModuleFileName(NULL,app_path,MAX_PATH);

// app_path is now the full path + file name of the exe
//  trim off the filename to get the path
//  etc 
Last edited on
Topic archived. No new replies allowed.