Dear friends,

I have an application that tests for the OS type being W9x or WNT and this is working OK without problems. The GDI32.dll has a function SetDCBrushColor that is not supported in 95/98/ME. Although I don't call it when I detect that the program is running on W9x, it still exists in the compilation for the case of the OS being NT5. (GDI32.dll exists for the 2 classes of OSs but the ones for 2K or XP supports that specific service, which does not exist in the W9x dll)
I can't execute the program now in W9x because the linker sees the call and refuses to load and execute.
How do I specify that service to be run in a dynamic fashion only after detection that I am in NT5?

Thanks for the help,
Rudy.
:)
Posted on 2003-07-01 10:37:08 by Rudy Penteado
You could maybe put it in a DLL and dynamically load the routines that are NT only if NT is there and the 9x substitutes if 9x is detected. Give the routines the same names in each DLL and any calls would just be diverted to the proper DLL. Not a great solution but it would work.
Posted on 2003-07-01 10:52:32 by donkey
I think you can also get the handle to GDI with a call to LoadLibrary, then the pointer to the API call you need with GetProcAddress. This way you don't need to check the OS version, and keep compatibility with future versions of Windows: if the API exists, you can use it, if it doesn't, you can't :grin: .
Posted on 2003-07-01 12:27:49 by QvasiModo
QvasiModo & donkey,
Thank you very much. I used GetModuleHandle and GetProcAddress and it worked perfectly.
Regards,
Rudy.
:grin:
Posted on 2003-07-01 14:18:17 by Rudy Penteado