ÔÚ ¼ì ²â Ö® ºó £¬ Ó¦ ¸Ã Ê¹ ÓÃ PortOpen=False¹Ø ±Õ Modem¡£ 
    Èç ºÎ Äã Òª ÊÇ Ïë ÅÐ ¶Ï ÓÃ »§ ÊÇ ·ñ Óë InternetÏà Á¬ Ò² ¿É ÒÔ Õâ Ñù ×ö £º 
    ½« ÏÂ Ãæ µÄ ´ú Âë ¼Ó Èë Ò» ¸ö Ä£ ¿é £º 
     Public Const ERROR_SUCCESS = 0& 
     Public Const APINULL = 0& 
     Public Const HKEY_LOCAL_MACHINE = &H80000002 
     Public ReturnCode As Long 
     
     Declare Function RegCloseKey Lib "advapi32.dll" (ByVal _ 
     hKey As Long) As Long 
     
     Declare Function RegOpenKey Lib "advapi32.dll" Alias _ 
     "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As _ 
     String, phkResult As Long) As Long 
     
     Declare Function RegQueryValueEx Lib "advapi32.dll" Alias _ 
     "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName _ 
     As String, ByVal lpReserved As Long, lpType As Long, _ 
     lpData As Any, lpcbData As Long) As Long 
     
     Public Function ActiveConnection() As Boolean 
     Dim hKey As Long 
     Dim lpSubKey As String 
     Dim phkResult As Long 
     Dim lpValueName As String 
     Dim lpReserved As Long 
     Dim lpType As Long 
     Dim lpData As Long 
     Dim lpcbData As Long 
     ActiveConnection = False 
     lpSubKey = "System\CurrentControlSet\Services\RemoteAccess" 
     ReturnCode = RegOpenKey(HKEY_LOCAL_MACHINE, lpSubKey, _ 
     phkResult) 
     
     If ReturnCode = ERROR_SUCCESS Then 
     hKey = phkResult 
     lpValueName = "Remote Connection" 
     lpReserved = APINULL 
     lpType = APINULL 
     lpData = APINULL 
     lpcbData = APINULL 
     ReturnCode = RegQueryValueEx(hKey, lpValueName, _ 
     lpReserved, lpType, ByVal lpData, lpcbData) 
     lpcbData = Len(lpData) 
     ReturnCode = RegQueryValueEx(hKey, lpValueName, _ 
     lpReserved, lpType, lpData, lpcbData) 
     
     If ReturnCode = ERROR_SUCCESS Then 
     If lpData = 0 Then 
     ActiveConnection = False 
     Else 
     ActiveConnection = True 
     End If 
     End If 
     
     RegCloseKey (hKey) 
     End If 
     
     End Function 
     
    Äã ¾Í ¿É ÒÔ Ê¹ ÓÃ ActiveConnection½ø ÐÐ ¼ì ²â ÁË ¡£ 
     Private Sub Command1_Click() 
     If ActiveConnection = True Then 
     Call MsgBox("You have an active connection.", vbInformation) 
     Else 
     Call MsgBox("You have no active connections.", vbInformation) 
     End If 
     End Sub 
    Áí Íâ £¬ Èç ¹û °² ×° ÁË IE 4.0ÒÔ ÉÏ °æ ±¾ £¬ Ò² ¿É ÒÔ Ê¹ ÓÃ InternetGetConnectedStateº¯ Êý ÅÐ ¶Ï ÊÇ ·ñ Óë InternetÏà Á¬ £¬ Õâ ÖÖ ·½ ·¨ ²» ½ö ¿É ÒÔ ÅÐ ¶Ï ²¦ ºÅ ·½ Ê½ £¬ Ò² ¿É ÒÔ ÅÐ ¶Ï Í¨ ¹ý ¾Ö Óò Íø Á¬ ½Ó ¡£
<END>