Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2003-10-28
8
Medium Priority
?
201 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: 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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

670 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