使用VB的Socket開發(fā)網(wǎng)絡(luò)版來電管理軟件 |
chen在2007/8/4發(fā)表,被瀏覽6852次
|
適合對(duì)象:記得來電顯示管理器的網(wǎng)絡(luò)版 開發(fā)環(huán)境:Visual Basic 下載范例:JDDemo2.zip 使用環(huán)境:需要來電監(jiān)聽服務(wù)程序TeleListen.exe(點(diǎn)擊下載) 相關(guān)連接:來電管理器服務(wù)程序 備注:采用Socket網(wǎng)絡(luò)技術(shù),需要使用Microsoft WinSock Control
 VERSION 5.00 Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX" Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX" Begin VB.Form Form2 Caption = "來電顯示客戶端" ClientHeight = 3285 ClientLeft = 60 ClientTop = 450 ClientWidth = 4680 LinkTopic = "Form1" ScaleHeight = 3285 ScaleWidth = 4680 StartUpPosition = 3 '窗口缺省 Begin MSWinsockLib.Winsock Winsock1 Left = 1800 Top = 960 _ExtentX = 741 _ExtentY = 741 _Version = 393216 End Begin VB.CommandButton Command2 Caption = "關(guān)閉" Height = 495 Left = 3120 TabIndex = 6 Top = 2640 Width = 1335 End Begin VB.CommandButton Command1 Caption = "連接" Height = 495 Left = 3120 TabIndex = 5 Top = 1920 Width = 1335 End Begin RichTextLib.RichTextBox rtbMsg Height = 3015 Left = 120 TabIndex = 4 Top = 120 Width = 2775 _ExtentX = 4895 _ExtentY = 5318 _Version = 393217 Enabled = -1 'True TextRTF = $"Form2.frx":0000 End Begin VB.TextBox Text2 Height = 375 Left = 3120 TabIndex = 3 Text = "3825" Top = 1320 Width = 1335 End Begin VB.TextBox Text1 Height = 375 Left = 3120 TabIndex = 0 Text = "127.0.0.1" Top = 360 Width = 1335 End Begin VB.Label Label2 Caption = "Socket端口" Height = 255 Left = 3120 TabIndex = 2 Top = 1080 Width = 1215 End Begin VB.Label Label1 Caption = "服務(wù)器地址" Height = 255 Left = 3120 TabIndex = 1 Top = 120 Width = 975 End End Attribute VB_Name = "Form2" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Command1_Click() On Error GoTo ErrorPro With Winsock1 .RemoteHost = Text1.Text .RemotePort = CInt(Text2.Text) .Connect Exit Sub End With ErrorPro: rtbMsg.Text = rtbMsg.Text & "服務(wù)器未開或網(wǎng)絡(luò)出錯(cuò)!" & Chr(10) End Sub Private Sub Command2_Click() Winsock1.Close rtbMsg.Text = rtbMsg.Text & "已關(guān)閉連接" & Chr(10) End Sub Private Sub Form_Load() rtbMsg.Text = "" End Sub Private Sub Winsock1_Connect() rtbMsg.Text = rtbMsg.Text & "連接成功" & Chr(10) End Sub Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim s As String Dim p As Integer Winsock1.GetData s If Mid(s, 1, 1) = "#" Then p = InStr(s, " ") rtbMsg.Text = rtbMsg.Text & "來電號(hào)碼: " & Mid(s, 2, p - 2) & Chr(10) rtbMsg.Text = rtbMsg.Text & "來電時(shí)間: " & Mid(s, p + 1, 19) & Chr(10) End If End Sub
|
|
|
|