Source code dibawah ini bisa anda gunakan membuat klien IRC menggunakan VB 6 (simpel). klien IRC dibawah ini menggunakan 2 file dengan nama prjSimpleIRC.vbp dan frmChat.frm
Buka notepad dan paste source code dibawah ini, simpan dengan nama frmChat.frm
Buka notepad dan paste source code dibawah ini, simpan dengan nama prjSimpleIRC.vbp
Buka notepad dan paste source code dibawah ini, simpan dengan nama frmChat.frm
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form frmChat
BorderStyle = 4 'Fixed ToolWindow
Caption = "Simple IRC"
ClientHeight = 3645
ClientLeft = 45
ClientTop = 285
ClientWidth = 4110
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3645
ScaleWidth = 4110
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin MSWinsockLib.Winsock ws
Left = 120
Top = 120
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.TextBox txtOut
Height = 285
Left = 0
TabIndex = 1
Top = 3360
Width = 4095
End
Begin VB.TextBox txtIn
Height = 3375
Left = 0
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 0
Top = 0
Width = 4095
End
End
Attribute VB_Name = "frmChat"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const Server As String = "irc.slashnet.org" 'server yang akan anda gunakan
Const Port As Integer = 6667 'port server
Dim Nick As String 'nick
Private Sub Form_Load()
ws.Connect Server, Port 'memulai koneksi
Nick = "Tester" & LTrim(RTrim(Str(Int(Rnd * 100))))
End Sub
Function Connected() As Boolean
If ws.State = sckConnected Then
Connected = True
Else
Connected = False
End If
End Function
Private Sub txtOut_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 And Connected Then
ws.SendData Me.txtOut.Text & vbCrLf 'kirim teks pada txtOut
Me.txtOut.Text = "" 'hapus txtOut
End If
End Sub
Private Sub ws_Connect()
Dim UserName, RealName As String
UserName = Nick
RealName = Nick
'mengirimkan nama user dan nama nick
ws.SendData "USER " & UserName & " 0 * " & RealName & vbCrLf
ws.SendData "NICK " & Nick & vbCrLf
End Sub
Private Sub ws_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
ws.GetData strData 'ambil data berupa string
DoEvents
If InStr(strData, "PING") <> 0 Then
ws.SendData Replace(strData, "PING", "PONG") & vbCrLf
End If
Me.txtIn.Text = Me.txtIn.Text & strData
If Len(Me.txtIn.Text) > 10000 Then
Me.txtIn.Text = Right(Me.txtIn.Text, 10000)
Me.txtIn.SelStart = Len(Me.txtIn.Text) - 1
End Sub
Buka notepad dan paste source code dibawah ini, simpan dengan nama prjSimpleIRC.vbp
Type=Exe
Form=frmChat.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\WINDOWS\SYSTEM\StdOle2.Tlb#OLE Automation
Object={248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0; MSWINSCK.OCX
IconForm="frmChat"
Startup="frmChat"
HelpFile=""
Title="Membuat klien IRC menggunakan VB 6"
Command32=""
Name="SimpleIRC"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
0 comments:
Post a Comment