Link to home
Start Free TrialLog in
Avatar of honestman
honestman

asked on

How to obtain the info of modem installed in my OS?

I want to know what modem had been installed in my os, and their state.
Some people said that they had been saved in register.
But my USB modem can be check in real time by os.
How to obtain the state of my USB modem?
Avatar of Mikal613
Mikal613
Flag of United States of America image

to see if modem is connected

 Return True if the modem is connected.
' (Actually this also returns False if there is
' an error reading the registry.)
Function ModemIsConnected() As Boolean
Dim result As Long
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

    ModemIsConnected = False

    lpSubKey = _
        "System\CurrentControlSet\Services\RemoteAccess"
    If RegOpenKey(HKEY_LOCAL_MACHINE, lpSubKey, phkResult) _
        <> ERROR_SUCCESS Then Exit Function

    hKey = phkResult
    lpValueName = "Remote Connection"
    lpReserved = APINULL
    lpType = APINULL
    lpData = APINULL
    lpcbData = APINULL

    If RegQueryValueEx(hKey, lpValueName, lpReserved, _
        lpType, ByVal lpData, lpcbData) _
        <> ERROR_SUCCESS _
    Then
        RegCloseKey hKey
        Exit Function
    End If
    lpcbData = Len(lpData)

    If RegQueryValueEx(hKey, lpValueName, lpReserved, _
        lpType, lpData, lpcbData) _
        <> ERROR_SUCCESS _
    Then
        RegCloseKey hKey
        Exit Function
    End If

    ModemIsConnected = (lpData <> 0)

    RegCloseKey hKey
End Function
 
 
Avatar of honestman
honestman

ASKER

To Mikal613:
    You have misunderstood my meaning.
    I do not want to know whether my system is connected to internet, I only wonder whether the USB modem is connected to my machine. I want to know what modem drivers are installed in my Win2000.
 
In "control panel" -> "phone and modem options" -> "Modems", It lists "The following modems are installed".
I want to know how to obtain this info in my program???
ASKER CERTIFIED SOLUTION
Avatar of fantasy1001
fantasy1001

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial