📄 myim.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "Mscomctl.ocx"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "mswinsck.ocx"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form MyIM
Caption = "IM"
ClientHeight = 4905
ClientLeft = 165
ClientTop = 735
ClientWidth = 2775
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "MyIM.frx":0000
LinkTopic = "Form1"
ScaleHeight = 4905
ScaleWidth = 2775
StartUpPosition = 3 '窗口缺省
Begin MSComDlg.CommonDialog CommonDialog
Left = 2280
Top = 3960
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Timer BuddyUpdater
Enabled = 0 'False
Interval = 15000
Left = 720
Top = 3960
End
Begin MSWinsockLib.Winsock Winsock1
Left = 1200
Top = 3960
_ExtentX = 741
_ExtentY = 741
_Version = 393216
RemoteHost = "127.0.0.1"
RemotePort = 6000
End
Begin VB.PictureBox Picture1
Align = 2 'Align Bottom
Height = 255
Left = 0
ScaleHeight = 195
ScaleWidth = 2715
TabIndex = 3
Top = 4650
Width = 2775
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "准备."
Height = 195
Left = 120
TabIndex = 5
Top = 0
Width = 420
End
End
Begin VB.CommandButton Command2
Enabled = 0 'False
Height = 495
Left = 495
Picture = "MyIM.frx":0442
Style = 1 'Graphical
TabIndex = 2
ToolTipText = " Change my Status "
Top = 0
Width = 495
End
Begin VB.CommandButton Command1
Enabled = 0 'False
Height = 495
Left = 0
Picture = "MyIM.frx":058C
Style = 1 'Graphical
TabIndex = 1
ToolTipText = " Send a Message "
Top = 0
Width = 495
End
Begin MSComctlLib.ImageList ImageList1
Left = 1680
Top = 3840
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "MyIM.frx":06D6
Key = "Online"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "MyIM.frx":0C28
Key = "Offline"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "MyIM.frx":0F7A
Key = "Away"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "MyIM.frx":12CC
Key = "DND"
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "MyIM.frx":161E
Key = "Unknown"
EndProperty
EndProperty
End
Begin MSComctlLib.TreeView TreeView1
Height = 2295
Left = 0
TabIndex = 0
Top = 480
Width = 2415
_ExtentX = 4260
_ExtentY = 4048
_Version = 393217
HideSelection = 0 'False
Indentation = 353
LabelEdit = 1
Sorted = -1 'True
Style = 7
HotTracking = -1 'True
ImageList = "ImageList1"
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "离线"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 195
Left = 2235
TabIndex = 4
Top = 150
Width = 390
End
Begin VB.Shape Shape1
BackColor = &H00808080&
BackStyle = 1 'Opaque
BorderColor = &H00808080&
Height = 495
Left = 0
Top = 0
Width = 2775
End
Begin VB.Menu mnuFile
Caption = "文件(&F)"
Begin VB.Menu mnuFileToggleLog
Caption = "注销(&L)"
End
Begin VB.Menu mnuFilePassword
Caption = "修改密码(&C)"
Enabled = 0 'False
End
Begin VB.Menu mnuFileChangeInfo
Caption = "修改信息(&M)"
Enabled = 0 'False
End
Begin VB.Menu mnuFileReport
Caption = "报告(&R)"
Enabled = 0 'False
End
Begin VB.Menu mnuFileSplit
Caption = "-"
End
Begin VB.Menu mnuStatus
Caption = "我的状态(&S)"
Enabled = 0 'False
Begin VB.Menu mnuStatusOnline
Caption = "在线(&O)"
Checked = -1 'True
End
Begin VB.Menu mnuStatusAway
Caption = "离开(&A)"
End
Begin VB.Menu mnuStatusDND
Caption = "免打扰(D)"
End
Begin VB.Menu mnuStatusSplit
Caption = "-"
End
Begin VB.Menu mnuStatusInvisible
Caption = "隐身(&I)"
End
End
Begin VB.Menu mnuFileSplit1
Caption = "-"
End
Begin VB.Menu mnuFileClose
Caption = "关闭(&C)"
End
End
Begin VB.Menu mnuBuddy
Caption = "我的好友(&B)"
Begin VB.Menu mnuBuddyMessage
Caption = "发送消息(&S)"
Enabled = 0 'False
End
Begin VB.Menu mnuBuddyChat
Caption = "实时聊天(&C)"
Enabled = 0 'False
End
Begin VB.Menu mnuBuddyFile
Caption = "文件传送(&T)"
Enabled = 0 'False
End
Begin VB.Menu mnuBuddyInfo
Caption = "用户信息(&U)"
Enabled = 0 'False
End
Begin VB.Menu mnuBuddySplit
Caption = "-"
End
Begin VB.Menu mnuBuddyAdd
Caption = "添加好友(&A)"
Enabled = 0 'False
End
Begin VB.Menu mnuBuddyRemove
Caption = "删除好友(&R)"
Enabled = 0 'False
End
Begin VB.Menu mnuBuddyIgnore
Caption = "黑名单(&B)"
Enabled = 0 'False
End
End
Begin VB.Menu mnuOther
Caption = "其它(&O)"
Visible = 0 'False
Begin VB.Menu mnuOtherChatFile
Caption = "文件搜索"
Enabled = 0 'False
End
End
Begin VB.Menu mnuHelp
Caption = "帮助(&H)"
Begin VB.Menu mnuHelpHomePage
Caption = "主页"
End
Begin VB.Menu mnuAbout
Caption = "关于(&A)..."
End
End
End
Attribute VB_Name = "MyIM"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'==================
'聊天程序主窗体
'显示用户好友,处理在线离线等事件
'==================
Public NewUser As Boolean
Public ImageAnimateNumber As Integer
'==========
'时间控制,实时刷新好友数量
'===========
Private Sub BuddyUpdater_Timer()
On Error Resume Next
Label2.Caption = "获取好友信息... (0/" & TreeView1.Nodes.Count & ")"
For i = 1 To TreeView1.Nodes.Count
Label2.Caption = "Checking buddy... (" & i & "/" & TreeView1.Nodes.Count & ")"
Winsock1.SendData ".getstatus " & TreeView1.Nodes(i).Key
DoEvents
Next
Label2.Caption = ""
End Sub
'===========
'聊天按钮
'===========
Private Sub Command1_Click()
mnuBuddyMessage_Click
End Sub
Private Sub Command2_Click()
'弹出状态右键菜单
PopupMenu mnuStatus, , Command2.Left, Command2.Top + Command2.Height
End Sub
'=============
'窗体启动过程
'=============
Private Sub Form_Load()
'在标题显示版本信息
Me.Caption = "ComX 版本 " & App.Major & "." & App.Minor & App.Revision
gFileNum = FreeFile
End Sub
'==============
'窗体大小调整过程
'=============
Private Sub Form_Resize()
On Error Resume Next
'改变Shape大小
Shape1.Width = Me.ScaleWidth
Label1.Left = Me.ScaleWidth - Label1.Width - 120
'改变好友列表大小
TreeView1.Width = Me.ScaleWidth
TreeView1.Height = Me.ScaleHeight - Shape1.Height - Picture1.Height
End Sub
'================
'窗体卸载过程
'================
Private Sub Form_Unload(cancel As Integer)
'关闭SOCKET
Winsock1.Close
End
End Sub
'============
'关于菜单
'============
Private Sub mnuAbout_Click()
'显示关于信息
MsgBox "ComX 版本 " & App.Major & "." & App.Minor & App.Revision, vbInformation
End Sub
'================
'添加新好友
'================
Private Sub mnuBuddyAdd_Click()
Dim Temp As String
'显示输入好友输入框
Temp = InputBox("请输入新好友信息?", "添加好友", "TheReaper")
If Temp = "" Then
Exit Sub
Else
'发送添加好友命令
Winsock1.SendData ".AddBuddy " & Connect.Text1.Text & " " & Temp
End If
End Sub
'=============
'聊天按钮过程
'=============
Private Sub mnuBuddyChat_Click()
On Error GoTo BuddyChatErr '错误处理
RTChatRemoteNick = TreeView1.SelectedItem '选择的好友
Winsock1.SendData ".GetIPForRTChat " & TreeView1.SelectedItem.Key '发送聊天命令
Exit Sub
BuddyChatErr:
If Err.Number = 91 Then
MsgBox "您没有选择任何好友.", vbInformation
Else
MsgBox Err.Number & ":" & Err.Description
End If
End Sub
'===========
'文件传输
'===========
Private Sub mnuBuddyFile_Click()
On Error GoTo BuddyFileErr '错误处理
FileSendRemoteNick = TreeView1.SelectedItem '选择的好友
'MsgBox FileSendRemoteNick
Winsock1.SendData ".GetIPForFileSend " & TreeView1.SelectedItem.Key '发送命令
Exit Sub
BuddyFileErr:
If Err.Number = 91 Then
MsgBox "您没有选择任何好友."
Else
MsgBox Err.Number & ":" & Err.Description
End If
End Sub
'==========
'黑名单按钮
'===========
Private Sub mnuBuddyIgnore_Click()
frmIgnore.Show
End Sub
'=============
'好友信息菜单
'=============
Private Sub mnuBuddyInfo_Click()
On Error GoTo BuddyInfoErr
RemoteNick = TreeView1.SelectedItem '选中的好友
Winsock1.SendData ".GetBuddyInfo " & TreeView1.SelectedItem.Key '发送取得好友信息命令
Exit Sub
BuddyInfoErr:
If Err.Number = 91 Then
MsgBox "您没有选择任何好友."
Else
MsgBox Err.Number & ":" & Err.Description
End If
End Sub
'=============
'聊天
'=============
Private Sub mnuBuddyMessage_Click()
On Error Resume Next
Dim NewIMessage As New IMessage '定义一个新聊天记录
NewIMessage.Show ownerform:=Me
NewIMessage.Label2.Caption = TreeView1.SelectedItem
NewIMessage.RecieversID = TreeView1.SelectedItem.Key
End Sub
'=========
'删除好友
'=========
Private Sub mnuBuddyRemove_Click()
On Error Resume Next
Winsock1.SendData ".RemoveBuddy " & TreeView1.SelectedItem.Key '发送删除好友命令
End Sub
'=========
'关闭
'=========
Private Sub mnuFileClose_Click()
Unload Me
End Sub
'=============
'设置新密码
'=============
Private Sub mnuFilePassword_Click()
Dim Temp As String
Temp = InputBox("请输入您的新密码?", "修改密码", Connect.Text2.Text)
If Temp = "" Then
Exit Sub
Else
'发送修改密码命令
Winsock1.SendData ".ChangePassword " & " " & Temp
End If
End Sub
'报告
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -