subhajit mondal subhajit mondal - 10 months ago 69
C++ Question

pegrp32c.dll and pegrp32d.dll loading in different types of windows

I want to load pegrp32c.dll for WINXP OS version and pegrp32d.dll for WIN7 version. How I can achieve this?
Also i dont have any idea about the above mention third party dll.
someone please expalain what it is how load difference version of dll to different version of windows

Answer Source

Well, you have to determine current Windows version first using Version Helper functions. Then load a dll using LoadLibrary method. Since you have not mentioned Windows Vista, I assume, that Windows XP rules will be applied for it.

#include <versionhelper.h>
   hLib = LoadLibrary(L"pegrp32d.dll");
   hLib = LoadLibrary(L"pegrp32c.dll");

   //report an error

If you want to link statically against this libraries, you have to create different versions of your application for Windows XP and Windows 7. You could use WINVER macro to determine target platform and #pragma comment instruction to select lib file to link against.

#pragma comment(lib, "pegrp32d.lib")
#pragma comment(lib, "pegrp32c.lib")


MSDN Version helper API


If you use old version of the Visual Studio you could install latest Platform SDK, or use GetVersion API call, declared in the windows.h. Be advised however, that this method could be unavailable since Windows 8.1 so that approach is not recommended.