Thanks for all your replys
@Trond & tinman GetCurrentDirectory() returns the path that the application code is in, so that cannot be the problem.
@PB I know that is is a solution, anyway, for the problem I have this does not work. I call functions from the oggvorbisfile.dll. The dll it's self is calling the two dlls ogg.dll and vorbis.dll. But when they exist inside the system32 folder as well, these versions are loaded as well (and they may not be of the same version then the one that I need).
I guess I found the problem:
Windows XP and Windows 2000 SP4: Safe DLL search mode is disabled by default. To enable this feature, create the SafeDllSearchMode registry value and set it to 1.
If SafeDllSearchMode is enabled, the search order is as follows:
The directory from which the application loaded.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The current directory.
The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key.
If SafeDllSearchMode is disabled, the search order is as follows:
The directory from which the application loaded.
The current directory.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key.
So maybe the SafeDLLSearchMode is enabled somehow on my computer...
a workaround that works is to set the "Create temp exe in source dir" flag - but
PLEASE!!! PB TEAM move this option to the compiler option screen. You have to set it for all(!) include file and if you forget one you get strange errors when compiling from this include file...