I think you posted something about this before, and I've done
some research since then. I've been successfully using a
variation of the following code for awhile now and it works fine.
Tom Hanlin said something about Ring detection being inconsistent,
but it's worked fine for me on a lowball Win LT modem on Win2000
and Windows Millenium. Anyway, here goes:
Code:
#Compile Exe "C:\RINGTEST.EXE" #Include "Win32api.inc" Function CommWait(ByVal PortHandle As Long) As Long Dim EventMaskIn As Long 'Bit Map Of Event that occured 'Tell Win32 What To Wait For: Call SetCommMask(PortHandle, %EV_RING) 'Now Wait: Call WaitCommEvent(PortHandle, EventMaskIn, ByVal 0&) Print "Ring Detected" End Function Function WinMain(ByVal hCurInstance As Long, _ ByVal hPrevInstance As Long, _ lpszCmdLine As Asciiz Ptr, _ ByVal nCmdShow As Long) Export As Long Dim hComm As Long Dim hCommPB As Long Dim hThread As Long Dim RingDetected As Long 'Open a PB Comm Port: Comm Open "COM3" As #hCommPB 'Get The Win32 Handle: hComm = FileAttr(hCommPB, 2) 'Set The Comm Port Params: Comm Set #hCommPB, Baud = 57600 Comm Set #hCommPB, Byte = 8 Comm Set #hCommPB, Parity = %False Comm Set #hCommPB, Stop = 0 Comm Set #hCommPB, TxBuffer = 2048 Comm Set #hCommPB, RxBuffer = 4096 Thread Create CommWait(hComm) To hThread Do Sleep 500 Thread Status hThread To RingDetected Loop Until RingDetected = 0 'Thread's Dead Print "Press Any Key To End" WaitKey$ Comm Close #hCommPB End Function
------------------
[email protected]
[This message has been edited by Wyman A Belts (edited July 05, 2000).]
Leave a comment: