Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-10-28
8
Medium Priority
?
203 Views
Last Modified: 2010-05-01
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?
0
Comment
Question by:honestman
  • 2
  • 2
8 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 9638932
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
 
 
0
 

Author Comment

by:honestman
ID: 9640067
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.
 
0
 

Author Comment

by:honestman
ID: 9640300
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???
0
 
LVL 5

Accepted Solution

by:
fantasy1001 earned 1000 total points
ID: 9640577
Yes, you are right, the installed modem listing is saved in registry
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Modem\0000

Example code: have not check yet!!

Sub YourSub()
'Requires RegObj.dll

Dim objRegKey as RegObj.RegKey
Dim objRegValue as RegObj.RegValue

On Error Resume Next

Set objRegKey =
RegKeyFromString("\HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Modem\0000")


If Err.Number =  0 Then
  For Each objRegValue in objRegKey.Values
      Select Case objRegValue.Name
          Case "ConnectedTo"
          Debug.? "Comm Port  " &  objRegValue.Value
          Case "DriverDate"
        Debug.? "Driver Date" & objRegValue.Value
          Case else
      End select
  Next

Else     Msgbox "Can't find the damn modem settings"
    Err.Clear ' I would normally Raise an error instead of the msgbox, but that is a whole other
discussion. I just put it here to

get the idea across

End If
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question