HOWTO: Programmatically Detect RAS Installation on Workstation

ID: Q181518


The information in this article applies to:
  • Microsoft Windows 95
  • Microsoft Windows NT Workstation version 4.0


SUMMARY

This article shows how to programmatically detect if RAS is installed on a Workstation.

The sample code included in this article takes into account that RAS might not be installed, even if a copy of the Rasapi32.dll exists in the system directory. Also a valid phone book entry and an active modem are not required.


MORE INFORMATION

The way to detect programatically whether or not RAS is installed is to perform a LoadLibrary on the Rasapi32. If the LoadLibrary fails, RAS is not installed.

The following sample code demonstrates one way to do this. The function RasInstalled returns TRUE if RAS is installed and returns FALSE if RAS is not installed.

Sample Code


   #define WIN32_LEAN_AND_MEAN

   #include <stdio.h>
   #include <windows.h>
   #include <ras.h>
   #include <raserror.h>
   #include <string.h>
   #include <winbase.h>

   BOOL RasInstalled(void)
   {
      HINSTANCE hDLL;      // Handle to DLL.

      hDLL = LoadLibrary("rasapi32");
      if (hDLL != NULL)
      { // RAS is installed.
         return TRUE;
      }
      else
      { // RAS in not installed.
         return FALSE;
      }
   } 

Additional query words:

Keywords : kbnetwork kbAPI kbNTOS400 kbRAS kbSDKPlatform kbWinOS95 kbGrpNet
Version : WINDOWS:95; winnt:4.0
Platform : WINDOWS winnt
Issue type : kbhowto


Last Reviewed: October 20, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.