Modem Won't Hang Up

TheWizardofInt
01-03-2002, 03:01 PM
Here is some code that hanps up a modem (in VB6 using the MSComm object)

It works in Win98 and Win2K pro but NOT Win NT4.0

Any idea?


iPause = 10

Private Sub HangUp()
On Error Resume Next
MSComm1.Output = "AT" + vbCr
Wait iPause
MSComm1.Output = "ATH0" + vbCr
Wait iPause
' Close the port.
MSComm1.PortOpen = False
Wait iPause
CancelButton.Enabled = False
DialButton.Enabled = True
CancelFlag = True
On Error GoTo 0
End Sub

Private Sub Wait(iWait As Integer)
Dim i As Long
Dim sRead As String
Dim lStall As Long

lStall = iWait
lStall = lStall * 10000
For i = 0 To lStall
sRead = Status
Next i
End Sub

boskomihic
01-04-2002, 02:57 AM
Why don't you just type:
MSComm1.Output = "ATH" + vbCr

Banjo
01-04-2002, 03:00 AM
Just a thought; is it necessary to send AT and then ATH? I thought that AT was just to let the modem know that you are about to send a command, and ATH does this already.

TheWizardofInt
01-04-2002, 07:19 AM
I will try dropping the AT but do you think that that would make the modem not hang up?

Thinker
01-04-2002, 08:59 AM
There are two main things that would keep the modem from
hanging up when trying to send it an ATH command. One, it never
receives the command (a possible problem with NT as security
likes to keep tight control over com ports,) and two, the modem
doesn't recognize the ATH as a valid command for hanging up (not
very likely since that command has been around since the first
hayes modem.) If you are able to send commands to the modem
to make it dial, then you should be able to make it hang up. If
you can't even make it dial, you aren't getting through to it at all.

TheWizardofInt
01-04-2002, 09:03 AM
It CAN dial. The security issue is a possibility - the group that is using this is kind of tight.

I will check that - thanks!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum