Microsoft KB Archive/103185: Difference between revisions

From BetaArchive Wiki
m (Text replacement - ">" to ">")
m (Text replacement - "&" to "&")
 
Line 64: Line 64:
       '***************************************************************
       '***************************************************************
         Option Explicit
         Option Explicit
         Const WNNC_NET_MultiNet = &H8000
         Const WNNC_NET_MultiNet = &H8000
         Const WNNC_SUBNET_WinWorkgroups = 4
         Const WNNC_SUBNET_WinWorkgroups = 4
         Const WNNC_NET_TYPE = 2
         Const WNNC_NET_TYPE = 2
Line 83: Line 83:
             IsWFW = False
             IsWFW = False
             If (wNetType And WNNC_NET_MultiNet) Then
             If (wNetType And WNNC_NET_MultiNet) Then
               IsWFW = ((wNetType And &HFFFF) And _
               IsWFW = ((wNetType And &HFFFF) And _
                     WNNC_SUBNET_WinWorkgroups) <> 0
                     WNNC_SUBNET_WinWorkgroups) <> 0
             End If
             End If
Line 90: Line 90:
<li>From the View menu, choose Immediate Window. Type the following in the Immediate window:<br />
<li>From the View menu, choose Immediate Window. Type the following in the Immediate window:<br />
<br />
<br />
<span class="kbd userinput"> MsgBox IIf(IsWFW(), "WFW", "Windows") &amp; " is running!"</span></li></ol>
<span class="kbd userinput"> MsgBox IIf(IsWFW(), "WFW", "Windows") & " is running!"</span></li></ol>


If Windows for Workgroups is running, you will see the message "WFW is running!"
If Windows for Workgroups is running, you will see the message "WFW is running!"

Latest revision as of 12:24, 21 July 2020

Knowledge Base


ACC: How to Tell If Windows for Workgroups Is Running

Article ID: 103185

Article Last Modified on 5/6/2003



APPLIES TO

  • Microsoft Access 1.0 Standard Edition
  • Microsoft Access 1.1 Standard Edition
  • Microsoft Access 2.0 Standard Edition



This article was previously published under Q103185

SUMMARY

Although Microsoft Windows and Windows for Workgroups can both display the same version number, you can determine whether Windows for Workgroups is running by using a Windows API call in an Access Basic function.

MORE INFORMATION

The following example can be used to determine if Windows for Workgroups is running.

NOTE: In the following sample code, an underscore (_) is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.

  1. Create a new module and enter the following code:

          '***************************************************************
          '  Declarations section of the module
          '***************************************************************
             Option Explicit
             Const WNNC_NET_MultiNet = &H8000
             Const WNNC_SUBNET_WinWorkgroups = 4
             Const WNNC_NET_TYPE = 2
    
             Declare Function WNetGetCaps% Lib "User" (ByVal nIndex%)
    
          '================================================================
          'This function returns True if Windows for Workgroups is running,
          'or False if it is not (generic Windows). It accomplishes this by:
          ' - Calling WNetGetCaps and retrieving the net type flag.
          ' - Inspecting the low word of the flag to see if the Windows for
          '   Workgroups bit is set.
          '================================================================
             Function IsWFW% ()
                Dim wNetType As Integer
    
                wNetType = WNetGetCaps(WNNC_NET_TYPE)
                IsWFW = False
                If (wNetType And WNNC_NET_MultiNet) Then
                   IsWFW = ((wNetType And &HFFFF) And _
                         WNNC_SUBNET_WinWorkgroups) <> 0
                End If
             End Function
                            
  2. From the View menu, choose Immediate Window. Type the following in the Immediate window:

    MsgBox IIf(IsWFW(), "WFW", "Windows") & " is running!"

If Windows for Workgroups is running, you will see the message "WFW is running!"

Keywords: kbhowto kbprogramming KB103185