📄 frmmain.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmmain
Caption = "Duzi-UDP TALK"
ClientHeight = 3615
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
ClipControls = 0 'False
Icon = "frmmain.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3615
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
Visible = 0 'False
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 300
Left = 0
TabIndex = 11
Top = 3315
Width = 4680
_ExtentX = 8255
_ExtentY = 529
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 2
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 4233
MinWidth = 4233
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 3616
MinWidth = 3616
Text = "Made by"
TextSave = "Made by"
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList ImageList1
Left = 2040
Top = 1320
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmmain.frx":0442
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmmain.frx":0896
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmmain.frx":0CEA
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmmain.frx":113E
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmmain.frx":1592
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 2 'Align Bottom
Height = 795
Left = 0
TabIndex = 10
Top = 2520
Width = 4680
_ExtentX = 8255
_ExtentY = 1402
ButtonWidth = 1032
ButtonHeight = 1349
Appearance = 1
Style = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 4
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Exit"
Object.ToolTipText = "Exit the Program"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Save"
Object.ToolTipText = "Save the Text as file"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Help"
Object.ToolTipText = "Program Help"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Email"
Object.ToolTipText = "Email the author"
ImageIndex = 5
EndProperty
EndProperty
BorderStyle = 1
End
Begin VB.Timer timflash
Enabled = 0 'False
Interval = 100
Left = 3720
Top = 1560
End
Begin VB.TextBox txtmain
Height = 1815
Left = 120
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Top = 120
Width = 3495
End
Begin VB.PictureBox Picture1
BackColor = &H00FF0000&
Height = 855
Left = 3720
ScaleHeight = 795
ScaleWidth = 795
TabIndex = 6
Top = 480
Width = 855
Begin VB.CommandButton cmdremote
Caption = "WHO?"
Height = 495
Left = 170
Style = 1 'Graphical
TabIndex = 7
Top = 120
Width = 495
End
End
Begin VB.TextBox txtself
Height = 495
Left = 960
TabIndex = 5
Top = 1080
Visible = 0 'False
Width = 1695
End
Begin VB.TextBox txtname
Height = 495
Left = 840
TabIndex = 4
Top = 960
Visible = 0 'False
Width = 1815
End
Begin VB.TextBox txtimg
Height = 495
Left = 720
TabIndex = 3
Top = 840
Visible = 0 'False
Width = 1695
End
Begin MSWinsockLib.Winsock wskudp
Left = 3360
Top = 2760
_ExtentX = 741
_ExtentY = 741
_Version = 393216
Protocol = 1
LocalPort = 787
End
Begin VB.CommandButton cmdsend
Caption = "&Send"
Default = -1 'True
Height = 255
Left = 3720
TabIndex = 2
Top = 2160
Width = 855
End
Begin VB.TextBox txtsend
Height = 270
Left = 120
TabIndex = 0
Top = 2160
Width = 3375
End
Begin VB.Label lblsound
Alignment = 2 'Center
BackColor = &H0000FF00&
BorderStyle = 1 'Fixed Single
Caption = "sound on"
Height = 255
Left = 3720
TabIndex = 9
Top = 120
Width = 855
End
Begin VB.Image imgtrans
Height = 495
Left = 3720
Stretch = -1 'True
Top = 1560
Visible = 0 'False
Width = 495
End
Begin VB.Image imgtemp
Height = 495
Left = 3720
Top = 1560
Visible = 0 'False
Width = 495
End
Begin VB.Label Label1
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Height = 225
Left = 4080
TabIndex = 8
Top = 1440
Width = 210
End
End
Attribute VB_Name = "frmmain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim ifsend As Boolean
Dim X, Y As Long
Dim sound As Boolean
Dim msg As Integer
Private Sub cmdremote_Click()
wskudp.SendData "??"
'wskudp.SendData "|>" & txtname.Text
'wskudp.SendData ">>" & txtself.Text
'wskudp.SendData ">|" & txtimg.Text
ifsend = True
End Sub
Private Sub cmdsend_Click()
Dim cmd As String
Dim fFile As Integer
fFile = FreeFile
On Error Resume Next
cmd = txtsend.Text
Select Case cmd
Case ""
wskudp.SendData wskudp.LocalHostName & " have no word to send but ENTER key!:)" & vbCrLf
Case "/who"
wskudp.SendData "??"
'wskudp.SendData "|>" & txtname.Text
'wskudp.SendData ">>" & txtself.Text
'wskudp.SendData ">|" & txtimg.Text
ifsend = True
Case "/sound"
lblsound_Click
Case "/exit"
End
Case "/save"
Open App.Path & "\text\" & txtname.Text & ".txt" For Append As fFile
Print #fFile, "Year:" & Date & "|| Time: " & Time
Print #fFile, txtmain.Text
Close fFile
StatusBar1.Panels(1).Text = "File has saved!"
Case "/help on"
frmhelp.Show
Case "/help off"
Unload frmhelp
Case Else
wskudp.SendData wskudp.LocalHostName & ":" & txtsend.Text & vbCrLf
End Select
txtsend.Text = ""
txtsend.SetFocus
msg = msg + 1
StatusBar1.Panels(1).Text = "messengs sent!" & " = " & Str(msg)
End Sub
Private Sub Form_Load()
On Error Resume Next
wskudp.RemotePort = 787
wskudp.RemoteHost = frmip.txtip.Text
wskudp.Bind
Unload frmip
ifsend = False
sound = True
txtmain.Text = "Hello, Your are welcome to [<Duzi-UDP-Room>]" & vbCrLf & "----------------------------->>>>>" & vbCrLf
wskudp.SendData wskudp.LocalHostName & " enter the Room >>>>>" & vbCrLf
X = frmmain.Width
Y = frmmain.Height
End Sub
Private Sub Form_Resize()
On Error Resume Next
If frmmain.Width <> X <> frmmain.Height <> Y Then
frmmain.Width = X
frmmain.Height = Y
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
wskudp.Close
End
End Sub
Private Sub lblsound_Click()
If sound = True Then
sound = False
lblsound.BackColor = RGB(255, 0, 0)
lblsound.Caption = "soundOff"
Else
sound = True
lblsound.BackColor = RGB(0, 255, 0)
lblsound.Caption = "sound on"
End If
End Sub
Private Sub timflash_Timer()
Static i As Integer
imgtrans.Picture = cmdremote.Picture
cmdremote.Picture = imgtemp.Picture
imgtemp.Picture = imgtrans.Picture
If Picture1.BackColor = RGB(255, 0, 0) Then
Picture1.BackColor = RGB(0, 0, 255)
Else
Picture1.BackColor = RGB(255, 0, 0)
End If
i = i + 1
If i > 15 Then i = 0: timflash.Enabled = False
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error Resume Next
Dim fFile As Integer
fFile = FreeFile
Select Case Button.Index
Case 1
End
Case 2
Open App.Path & "\text\" & txtname.Text & ".txt" For Append As fFile
Print #fFile, "Year:" & Date & "|| Time: " & Time
Print #fFile, txtmain.Text
Close fFile
StatusBar1.Panels(1).Text = "File has saved!"
Case 3
frmhelp.Show
Case 5
On Error Resume Next
Call ShellExecute(hwnd, "Open", "mailto:huangduzi@hotmail.com", "", App.Path, 1)
End Select
End Sub
Private Sub txtsend_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
cmdsend_Click
End If
End Sub
Private Sub wskudp_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next
Dim incoming As String
Dim cmd As String
wskudp.GetData incoming
cmd = Mid(incoming, 1, 2)
Select Case cmd
Case "??"
wskudp.SendData "|>" & txtname.Text
wskudp.SendData ">>" & txtself.Text
wskudp.SendData ">|" & txtimg.Text
Case "|>"
Label1.Caption = Mid(incoming, 3)
Label1.ToolTipText = "remote user's Name"
Case ">>"
cmdremote.Caption = ""
cmdremote.ToolTipText = Mid(incoming, 3)
Case ">|"
cmdremote.Picture = LoadPicture(App.Path & "\icon\" & Mid(incoming, 3) & "-1.gif")
imgtemp.Picture = LoadPicture(App.Path & "\icon\" & Mid(incoming, 3) & "-3.gif")
Case Else
'wskudp.GetData incoming
txtmain.Text = txtmain.Text & incoming
txtmain.SelStart = Len(txtmain.Text)
If sound = True Then
Playsound (App.Path & "\sound\msg.wav")
End If
If ifsend = True Then
timflash.Enabled = True
End If
End Select
End Sub
Public Sub Playsound(WavFile As String)
On Error Resume Next
Call sndPlaySound(WavFile$, SND_FLAG)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -