Implement call display with MSCOMM controls

zhaozj2021-02-16  42

The power display of the caller display mod command CID and VCID are settings whether the settings are displayed. If the telecommunications opens the caller ID, the other party's phone number can be displayed via MODEM. Then first set the CID = 1 or vCID = 1

As usual, the information displayed is: DATE = MMDD "Call Date MMDDTIME = HHMM" Call Time HHMMNMBR = ####### "The caller number implementation is as follows, set the relevant settings of MSCOMM1, and bucking two label Label1 and Label2

FUNCTION

OpenCID (OpenClose)

AS

Boolean

)

AS

Boolean

'

Open or Gupby power display function

On

Error

Resume

NEXT

DIM

Arrcid

1

)

AS

String

Arrcid

0

)

=

"

AT # CID =

"

&

IIF (OpenClode,

1

,

0

Arrcid

1

)

=

"

AT # vcid =

"

&

IIF (OpenClode,

1

,

0

) MScomm1.rthreshold

=

0

For

i

=

0

TO

1

Mscomm1.output

=

Arrcid (i)

&

VBCR EndTime

=

Timer

0.5

DO

While

BSTOP

=

False

Ntemp

=

Ntemp

1

IF

Mscomm1.inbuffercount

> =

2

THEN

STEMP

=

Mscomm1.input

IF

Instr

(Stemp,

"

OK

"

)

=

0

THEN

BSTOP

=

True

OpenCID

=

True

Exit

FUNCTION

End

IF

End

IF

IF

Timer

> =

Endtime

Oral

ErrorCode

THEN

Exit

DO

Loop

NEXT

I OpenCID

=

False

Mscomm1.rthreshold

=

1

END FUNCTION

The following function displays the caller ID and displayed on the Label2 of the Label1 on the form.

Private

Sub

MSCOMM1_ONCOMM ()

On

Error

Resume

NEXT

Static buffer

AS

String

'

The number of characters set up to the RTHRESHOLD attribute (RTHRESHOLD attribute must be greater than 0).

'

Label1 = "Receive" Str (MSComm1.inbufferCount) "Character"

Buffer

=

Buffer

Mscomm1.input buffer

=

Ucase

(Buffer)

'

EXIT SUB

IF

Instr

(

1

Buffer,

"

Ring

"

, Vbtextcompare)

THEN

'

Received shocks

'

Comm1.output = "ATA" chr (13) 'Command MODEM off-hook response

Buffer

=

""

'

Clear buffer character

'

McIExecute "Sound" & SystemPath & "ingin.wav" label1

=

"

Status: Received a shock ring

"

Zhen

=

True

FRMCALLID.SHOW frmcallid.changering

Elseif

Instr

(

1

Buffer,

"

Connect

"

, Vbtextcompare)

THEN

'

The other party answers a call

Buffer

=

""

'

Clear buffer character

Label1

=

"

Status: Connection has been established

"

Elseif

Instr

(

1

Buffer,

"

Busy

"

, Vbtextcompare)

THEN

'

Coordination

Buffer

=

""

'

Clear buffer character

Label1

=

"

Status: The other party is busy

"

Elseif

Instr

(

1

Buffer,

"

NO DIA

"

, Vbtextcompare)

THEN

Buffer

=

""

'

Clear buffer character

Label1

=

"

Status: Dialing the number error, please check the phone line

"

Command1_click

Elseif

Instr

(

1

Buffer,

"

No carrier

"

, Vbtextcompare)

THEN

'

The other party has not taken a unit or not responding

Buffer

=

""

'

Clear buffer character

Label1

=

"

Status: The other party is not taken

"

Elseif

Instr

(

1

Buffer,

"

NMBR =

"

, Vbtextcompare)

THEN

TMPSTR

=

Instr

(

1

Buffer,

"

NMBR

"

, Vbtextcompare) Callnum

=

Right

(Buffer,

Len

(Buffer)

-

LLL

-

6

) Label2.caption

=

"

Ether phone:

"

Callnum

'

Buffer = "" 'clear buffer characters

Elseif

Instr

(

1

Buffer,

"

OK

"

, Vbtextcompare)

And

ASC

(

Right

(Buffer,

1

))

=

10

THEN

IF

Zhen

=

False

THEN

Buffer

=

""

'

Clear buffer character

IF

Command1.caption

=

"

hang up

"

THEN

Label2.caption

=

"

Status: Some calls:

"

TXTCALLNUM

End

IF

End

IF

End Sub

转载请注明原文地址:https://www.9cbs.com/read-27336.html

New Post(0)