In C++ application, I want to wait until runtime to choose the path to the openGL32.dll that is called. There are two possible paths: path #1 is the path to the directory in which the application resides (which is in the Program Files (x86) directory; path #2 is the system folder. Just having the openGL32.dll present in the application's directory results in it being called. I'd like to have the option of continuing to leave the openGL32.dll in the application directory, but just NOT call it but instead use the openGL32.dll in the System directory.
I've tried a couple approaches and neither of them work thus far. So, here is some additional info:
In the project settings, I am linking against opengl32.lib,, glu32.lib, and glaux.lib. Also in the project settings, I have listed openGL32.dll under the "Delay Loaded Dlls" field. In my application's InitInstance(), I have tried calling SetDllDirectory("C:\\Windows\\System32\\openGL32.dll"); however, even though this function returns TRUE, the openGL32.dll that resides in the application's directory STILL GETS LOADED AND USED.
I've also tried calling LoadLibrary("C:\\Windows\\System32\\openGL32.dll") from IniitInstance(), thinking this would "force" the system version to be used; however, even though this function returns a valid handle to the dll, the openGL32.dll that resides in the application's directory STILL GETS LOADED AND USED.
I've also tried a quick and dirty approach of moving the openGL32.dll out of the application's directory, which would then "force" the openGL32.dll in the System folder to be used; however, due to permissions issues with out users (not being given permission to delete/move files from the application directory, this is not the preferred approach.
Any help would be greatly appreciated!!!