Can anyone please tell me if it is possible to check through VB whether someone has a modem installed and what com port it's using and things like that? Thanx in advance
Hi , this is an example to check if modem is available and on which port is connected , hope this code would answer your question
<-----------
If WitchComm(DIALER) > 0 Then
StatusBar1.Panels(4).Picture = LoadPicture(App.Path & "\Phone.bmp"
StatusBar1.Panels(4).Text = "Modem Available on port : " & Str(WitchComm(DIALER))
Else
StatusBar1.Panels(4).Text = "Modem not Avialable"
End If
Function WitchComm(MyForm As DIALER) As Integer
Dim Port, x As Integer
Dim instring As String
On Error GoTo errr:
Port = 1
PortinG:
MyForm.MSComm1.CommPort = Port
MyForm.MSComm1.PortOpen = True
Do: DoEvents
x = x + 1
If x = 1000 Then MyForm.MSComm1.Output = "AT" + Chr$(13)
If x = 2000 Then MyForm.MSComm1.Output = "AT" + Chr$(13)
If x = 3000 Then MyForm.MSComm1.Output = "AT" + Chr$(13)
If x = 4000 Then MyForm.MSComm1.Output = "AT" + Chr$(13)
If x = 5000 Then MyForm.MSComm1.Output = "AT" + Chr$(13)
If x = 6000 Then MyForm.MSComm1.Output = "AT" + Chr$(13)
If x = 7000 Then
MyForm.MSComm1.PortOpen = False
Port = Port + 1
GoTo PortinG:
If MyForm.MSComm1.CommPort >= 5 Then
errr:
' MsgBox "Can't Find Modem!"
GoTo done:
End If
End If
Loop Until MyForm.MSComm1.InBufferCount >= 2
instring = MyForm.MSComm1.Input
MyForm.MSComm1.PortOpen = False
' Text1.Text = myform.MSComm1.CommPort & instring
' MsgBox "Modem Found On Comm" & Port
WitchComm = Port
Thanx for that. Do you know whether there's is an API call or something like that, that will return the name of all modems installed so you can actually pick between them? Thanx in advance
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.