 |
 |

01-08-2002, 02:17 AM
|
|
|
Detect modem ring event
|
I have a simple DAC form using an ADODC. I want to be able to respond to the PC's modem receiving a phone call and then perform a record operation. (Adodc1.Recordset.MoveLast) PC is running Win98SE.
Thanks for any help on this.
|
|

01-08-2002, 04:51 AM
|
 |
Funky Monkey
* Expert *
|
|
Join Date: Nov 2001
Location: England
Posts: 1,289
|
|
|
Use the MSCOMM control.
Put it on a form, set its RThreshold to 1, open the comm port the modem is on, and you'll receive "RING" when its ringing.
|
|

01-09-2002, 07:35 PM
|
|
|
need more help on MSCOMM
I did what you said but still can't get it to work.  Here is my code:
Private Sub MSComm1_MSComm(RThreshold As Integer)
Timer1.Enabled = True
If RThreshold = 1 And Timer1.Enabled = True Then
Adodc1.Recordset.MoveLast
Adodc1.Refresh
Timer1.Enabled = False
End If
End Sub
|
|

01-09-2002, 11:15 PM
|
|
|
It works now, but there is a problem...
|
I figured out the code and the settings to make it work. For this code to work I need to first set MSComm1.portopen = True:
Private Sub MSComm1_OnComm()
If Timer1.Enabled = False Then
Adodc1.Recordset.MoveLast
Timer1.Enabled = True
End If
End Sub
The timer is to prevent additional rings from causing uneccesary record moves.
The problem is, when PortOpen = true, the comm port (3) is "stolen" from the modem which is being used for voice calls.
Is there a way to just "detect" the modem ring without having to dedicate comm 3 to this VB app?
|
|

01-10-2002, 10:48 AM
|
|
|
It seems so simple, but
|
I'm beginning to think it's next to impossible. There should be some event that VB can trigger on when the modem rings/picks-up. Or maybe it will have to be detected at the application using the modem as a speakerphone (presently Cheyenne Bitware Bitphone, but this may change).
|
|

01-10-2002, 11:32 AM
|
 |
Lost Soul
Super Moderator * Guru *
|
|
Join Date: May 2001
Location: Vorlon
Posts: 18,885
|
|
Only react in the MSComm1_OnComm on the right event.
From the help:
Code:
Private Sub MSComm1_OnComm ()
Select Case MSComm1.CommEvent
' Handle each event or error by placing
' code below each case statement
' Errors
Case comEventBreak ' A Break was received.
Case comEventFrame ' Framing Error
Case comEventOverrun ' Data Lost.
Case comEventRxOver ' Receive buffer overflow.
Case comEventRxParity ' Parity Error.
Case comEventTxFull ' Transmit buffer full.
Case comEventDCB ' Unexpected error retrieving DCB]
' Events
Case comEvCD ' Change in the CD line.
Case comEvCTS ' Change in the CTS line.
Case comEvDSR ' Change in the DSR line.
Case comEvRing ' Change in the Ring Indicator.
Case comEvReceive ' Received RThreshold # of
' chars.
Case comEvSend ' There are SThreshold number of
' characters in the transmit
' buffer.
Case comEvEof ' An EOF charater was found in
' the input stream
End Select
End Sub
Edit: Replaced wrong tags
|
Last edited by Flyguy; 01-10-2002 at 02:13 PM.
|

01-10-2002, 12:24 PM
|
|
|
Still working on a solution
Yes I found this in the help too. But it doesn't seem to let VB "see" any events unless the PortOpen is set to True, which as I mentioned before, kills my other application that is running which utilizes the modem/speakerphone.
Any other solutions/ideas? 
|
Last edited by tweekz; 01-10-2002 at 04:14 PM.
|

01-11-2002, 03:07 AM
|
 |
Funky Monkey
* Expert *
|
|
Join Date: Nov 2001
Location: England
Posts: 1,289
|
|
|
Of course you can't. The MSComm control doesn't have any control over the port unless its open. You can't share a port between two applications.
|
|

01-12-2002, 02:12 PM
|
|
|
Of course you can't?
|
Forgive my ignorance, was not aware of that fact. What about Winsock?
Aren't there any "out-of-the-box" thinkers out there? Remember,"There are no problems, only solutions..."
|
|

01-12-2002, 02:16 PM
|
 |
Political Coder
Retired Moderator * Guru *
|
|
Join Date: Mar 2001
Location: London, England
Posts: 8,037
|
|
|
Winsock is merely for communication, it doesnt offer direct control over hardware.
|
|

01-12-2002, 02:48 PM
|
|
|
|
I don't need "direct control" over it, I just want to monitor what's happening. Isn't there any other way VB could detect some event associated with the modem ringing? Maybe at the sound card interface?
|
|

01-12-2002, 03:11 PM
|
|
Iron-Fisted Programmer
Retired Moderator * Guru *
|
|
Join Date: Jul 2001
Location: Fayetteville Arkansas USA
Posts: 18,127
|
|
|
Here is a brute force method. Install a second modem. Set it to
not answer. Split the phone line to both of them. Just monitor
the second modem for rings. (This doesn't even have to be an
internal modem, an external one connected to a serial port should
be able to send ring messages that the mscomm control can read.)
|
|

01-12-2002, 04:30 PM
|
|
|
|
Yup, that's brute force all right! And it would def work but, I would rather not have to purchase/install 120+ modems on PCs.
Here's the background on this project:
Have 12 agent PCs connecting to a telephone server running 3rd party auto-dialing app which utilizes an Access 95 format database. As the app runs and calls are dialed, records are added to one table of the DB about 1 or 2 per minute. When a call is transferred to a live agent (modem ringing) the agent sees the most recent record (with my app running) that was added, displaying the customer info of the person who was just called by the phone server and transferred to the live agent.
Everything works except that I use a timer to refresh the ADODC on my app every 6 sec to catch new records as they are added. This is a problem if the agent is updating a record and then the ADODC refreshes erasing any info they typed in. I could put logic on the form to disable the timer while form has focus or something similar, but I would rather not do it that way.
So far my app is completely client-side with nothing installed on the server for it to work (trying to use KISS theory). I could also make an app to run on the server in conjunction with the 12 agent PCs to provide the necessary function too, but again I'm trying to keep it simple.
Thanks to all!
|
|

01-12-2002, 04:58 PM
|
 |
Hell's Angel
Retired Moderator * Guru *
|
|
Join Date: Jul 2001
Location: Yorkshire, UK
Posts: 10,394
|
|
|
We had a similar problem with sharing a com port between programs. The way we solved it was to write a small app to access the com port. This app also accepts winsock connections from clients. Other apps send winsock commands to this app to control the com port and get status and data message back through winsock too.
The way we worked it was to have the client apps tell the com port app to open as either controller or monitor. If the com port already has a controller connection then it doesn't accept more until the current one disconnects or times out. All MSComm events get bounced through to all clients over winsock.
|
__________________
A wise one man once said "what you talking about dog breath"
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|