Solved

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

Posted on 2003-10-28
8
193 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: 9638831
0
 
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 250 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
VBA saving file message display 5 47
Updates not working for MS Windows 7 12 126
VBA filters 2 39
Microsoft Access combo box help 2 30
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now