Click to See Complete Forum and Search --> : LoadLibrary fail
Thanh Do
July 20th, 2003, 06:38 PM
I created a DLL using VC++ 7.0 and it loaded successfully under WinXP, but under Win9x, it failed. I read in MSDN that under Win9x, LoadLibrary will fails if its subsystem version is greater than 4.0. How can I detect this "subsystem version". Help me pliz!
Mick
July 20th, 2003, 06:48 PM
Originally posted by Thanh Do
I created a DLL using VC++ 7.0 and it loaded successfully under WinXP, but under Win9x, it failed. I read in MSDN that under Win9x, LoadLibrary will fails if its subsystem version is greater than 4.0. How can I detect this "subsystem version". Help me pliz!
Use GetVersionEx(...) to determine your OS. Look in MSDN docs for sample or on MSDN.microsoft.com
Andreas Masur
July 20th, 2003, 08:12 PM
#include <windows.h>
OSVERSIONINFO OSInfo;
memset(&OSInfo, 0, sizeof(OSInfo));
// Set size
OSInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if(::GetVersionEx((OSVERSIONINFO *) &OSInfo) == FALSE)
return false;
switch(OSInfo.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:
if(OSInfo.dwMajorVersion <= 4)
// Microsoft Windows NT
if((OSInfo.dwMajorVersion == 5) && (!OSInfo.dwMinorVersion))
// Microsoft Windows 2000
if((OSInfo.dwMajorVersion == 5) && (OSInfo.dwMinorVersion == 1))
// Microsoft Windows XP
break;
case VER_PLATFORM_WIN32_WINDOWS:
if((OSInfo.dwMajorVersion == 4) && (!OSInfo.dwMinorVersion))
if(OSInfo.szCSDVersion[1] == 'C')
// Microsoft Windows 95 OSR2
else
// Microsoft Windows 95
if((OSInfo.dwMajorVersion == 4) && (OSInfo.dwMinorVersion == 10))
if(OSInfo.szCSDVersion[1] == 'A')
// Microsoft Windows 98 SE
else
// Microsoft Windows 98
if((OSInfo.dwMajorVersion == 4) && (OSInfo.dwMinorVersion == 90))
// Microsoft Windows ME
break;
case VER_PLATFORM_WIN32s:
// Microsoft Win32s
break;
}
You can also take a look at this article (http://www.codeproject.com/system/dtwinver.asp). This is one of the most comprehensive tool for OS detection I saw...
Thanh Do
July 21st, 2003, 03:40 AM
Thanks for your help. But something I look around here is "subsystem version of the DLL", or how can I make a DLL that run both on Win 9x and Win XP.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.