How to Determine Whether Windows for Workgroups is Running
  
PSS ID Number: Q114470
Article last modified on 03-23-1995
 
3.10
 
WINDOWS
 

----------------------------------------------------------------------
The information in this article applies to:
 
 - Microsoft Windows Software Development Kit (SDK) for Windows
   version 3.1
 - Microsoft Windows for Workgroups SDK version 3.11
----------------------------------------------------------------------
 
SUMMARY
=======
 
Historically, a Windows program could distinguish versions of Windows by
using GetVersion(). However, Windows for Workgroups (WFW) 3.1 was
introduced after Windows 3.1, yet it contains the same version number as
Windows 3.1. This was done because WFW 3.1 is Windows 3.1, but with some
additional DLLs and VxDs for the network support. Note that there has been
a second release of WFW, which is version 3.11. This means that if
GetVersion() returns version 3.1, there is no way to determine whether the
operating system is Windows or WFW. If the version returned is 3.11, then
the operating system is WFW.
 
While there is no Windows 3.1 API which can be used to absolutely determine
which of these operating systems is running, it is possible to make this
determination. This article describes a method which can be used.
 
MORE INFORMATION
================
 
In order to determine whether or not Windows for Workgroups is running when
GetVersion() returns version 3.1, the first step is to see if WNetGetCaps()
is present. If it is, call it to check if there is a multinet driver
installed.
 
If there is, then the system is Windows for Workgroups. The following code
sample demonstrates this:
 
   #define WNNC_NET_MultiNet           0x8000
   #define WNNC_SUBNET_WinWorkgroups   0x0004
   #define WNNC_NET_TYPE               0x0002
 
   HINSTANCE hModInst      = NULL;
   FARPROC   lpWNetGetCaps = NULL;
   WORD      wNetType;
 
   hModInst = LoadLibrary( "USER.EXE" );
   if( !(lpWNetGetCaps = GetProcAddress( hModInst, (LPSTR)"WNetGetCaps")) )
      MessageBox (hWnd, "WNetGetCaps Not Found", NULL, MB_OK);
   else
   {¬
   // Get the network type
      wNetType = (*lpWNetGetCaps) (WNNC_NET_TYPE);
      if( wNetType & WNNC_NET_MultiNet )
      {¬
      // a multinet driver is installed
         if( LOBYTE(wNetType) & WNNC_SUBNET_WinWorkgroups )
         // It is WFW
            MessageBox( hWnd, "Windows for Workgroups", NULL, MB_OK);
         else
         // It is not WFW
            MessageBox( hWnd, "Not Windows for Workgroups", NULL, MB_OK);
      }
   }
 
   // Clean up the module instance
   if( hModInst )
      FreeLibrary( hModInst );
 
Additional reference words: 3.10
KBCategory: kbnetwork kbprg
KBSubcategory: NtwkMisc
=============================================================================
Copyright Microsoft Corporation 1995.
