Selasa, 17 November 2009

Telephone via Komputer

Komponen yang dibutuhkan mscomm32.ocx. Copy paste kode ini ke form dengan 3 command button.
Maap lagi masih copy paste, yg asli ditunggu nanti coba q upload...

Nah nih langsung download
Download Source Code

'Windows API/Global Declarations for :Di
' al A Phone # With the MSCOMM
Option Explicit
DefInt A-Z
Dim CancelFlag

' Name: Dial A Phone # With the MSCOMM
' Description:This code is to show you h
' ow to dial a phone # useing a .ocx that
' comes with vb.
' By: Flyman
' Assumes:Beaware: Do not call people yo
' u do not know! It can be traced! Also do
' not use as a "Warez" Dialer(make it into
' one)
' Side Effects:It may not dial if you pu
' t the - (ex:1-805-230-9271)
'This code is copyrighted and has' limited warranties.Please see http://w
' wCode.asp?txtCodeId=4843&lngWId=1'for details.'**************************************

Private Sub CancelButton_Click()
CancelFlag = True
CancelButton.Enabled = False
End Sub

Private Sub Dial(Number$)
Dim DialString$, FromModem$, dummy
DialString$ = "ATDT" + Number$ + ";" + vbCr
MSComm1.CommPort = 9
MSComm1.Settings = "9600,N,8,1"
On Error Resume Next
MSComm1.PortOpen = True

If Err Then
MsgBox "COM9: Not available. Change the CommPort Property To another port."
Exit Sub
End If
MSComm1.InBufferCount = 0
MSComm1.Output = DialString$

dummy = DoEvents()

If MSComm1.InBufferCount Then
FromModem$ = FromModem$ + MSComm1.Input

If InStr(FromModem$, "OK") Then

MsgBox "Please pick up the phone and either press Enter or click OK"
Exit Do
End If
End If
'got help from microsoft

If CancelFlag Then
CancelFlag = False
Exit Do
End If
MSComm1.Output = "ATH" + vbCr
MSComm1.PortOpen = False
End Sub

Private Sub DialButton_Click()
Dim Number$, Temp$
Dim status As String
DialButton.Enabled = False
QuitButton.Enabled = False
CancelButton.Enabled = True
Number$ = InputBox$("Enter phone number:", Number$)
If Number$ = "" Then Exit Sub
Temp$ = status
status = "Dialing - " + Number$
Dial Number$
DialButton.Enabled = True
QuitButton.Enabled = True
CancelButton.Enabled = False
status = Temp$
End Sub

Private Sub Form_Load()
MSComm1.InputLen = 0
End Sub

Private Sub QuitButton_Click()
End Sub


Tidak ada komentar:

Posting Komentar