VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get Modem Port

by liaqat fayyaz (10 Submissions)
Category: Internet/HTML
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 8th May 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get Modem Port

Rate Get Modem Port




Private Sub Form_Load()
  Dim s As String
  Dim iPort As Integer
  Dim n As Single
  Dim bModem As Boolean
  
  For iPort = 1 To 4
    With MSComm1
      .CommPort = iPort
      .Settings = "9600,N,8,1"
      .InputLen = 0
      On Error Resume Next
      .PortOpen = True
      If Err = 0 Then
        .Output = "ATV1Q0" & Chr$(13)
        n = Timer
        While Timer - n < 1
          DoEvents
        Wend
        s = s & .Input
        .PortOpen = False
        If InStr(s, "OK" & vbCrLf) <> 0 Then
          MsgBox "Modem detected on COM" & iPort
          bModem = True
          Exit For
        End If
      End If
    End With
  Next
  If Not bModem Then MsgBox "No modem detected"
  End
End Sub


Download this snippet    Add to My Saved Code

Get Modem Port Comments

No comments have been posted about Get Modem Port. Why not be the first to post a comment about Get Modem Port.

Post your comment

Subject:
Message:
0/1000 characters