📄 formdsystem.frm
字号:
VERSION 5.00
Object = "{4932CEF1-2CAA-11D2-A165-0060081C43D9}#2.0#0"; "Actbar2.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form FormDSystem
Caption = "分布式环境"
ClientHeight = 5250
ClientLeft = 60
ClientTop = 345
ClientWidth = 8220
LinkTopic = "Form1"
ScaleHeight = 5250
ScaleWidth = 8220
StartUpPosition = 3 'Windows Default
Begin VB.PictureBox Picture2
Height = 4900
Left = 1680
ScaleHeight = 4845
ScaleWidth = 6195
TabIndex = 9
Top = 0
Width = 6255
Begin MSComctlLib.StatusBar StatusBar1
Height = 255
Left = 120
TabIndex = 21
Top = 4440
Width = 6015
_ExtentX = 10610
_ExtentY = 450
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 2
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 5292
MinWidth = 5292
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 5292
MinWidth = 5292
EndProperty
EndProperty
End
Begin MSWinsockLib.Winsock Winsock1
Left = 4320
Top = 960
_ExtentX = 741
_ExtentY = 741
_Version = 393216
RemoteHost = "yr"
RemotePort = 80
End
Begin VB.Frame Frame2
Caption = "本地IP"
Enabled = 0 'False
Height = 1455
Left = 120
TabIndex = 18
Top = 2880
Width = 6015
Begin VB.TextBox Text2
Height = 1095
Left = 120
TabIndex = 20
Top = 240
Width = 5775
End
End
Begin VB.Frame Frame1
Caption = "远程IP"
Enabled = 0 'False
Height = 1455
Left = 120
TabIndex = 17
Top = 1440
Width = 6015
Begin VB.TextBox Text1
Height = 1095
Left = 120
TabIndex = 19
Top = 240
Width = 5775
End
End
Begin VB.CommandButton cmdConnect
Caption = "连接"
Height = 735
Left = 4200
TabIndex = 16
Top = 120
Width = 1335
End
Begin VB.TextBox txtLocalPort
Height = 285
Left = 1800
TabIndex = 15
Text = "80"
Top = 1080
Width = 1695
End
Begin VB.TextBox txtRemotePort
Height = 285
Left = 1800
TabIndex = 14
Text = "80"
Top = 600
Width = 1695
End
Begin VB.TextBox txtRemoteIP
Height = 285
Left = 1800
TabIndex = 13
Top = 120
Width = 1695
End
Begin VB.Label Label6
Caption = "远程网络端口"
Height = 375
Left = 120
TabIndex = 12
Top = 1080
Width = 1335
End
Begin VB.Label Label5
Caption = "本地网络端口"
Height = 375
Left = 120
TabIndex = 11
Top = 600
Width = 1335
End
Begin VB.Label Label4
Caption = "对方计算机IP地址"
Height = 375
Left = 120
TabIndex = 10
Top = 120
Width = 1695
End
End
Begin ActiveBar2LibraryCtl.ActiveBar2 ActiveBarD
Height = 5250
Left = 0
TabIndex = 8
Top = 0
Width = 8220
_LayoutVersion = 1
_ExtentX = 14499
_ExtentY = 9260
_DataPath = ""
Bands = "FormDSystem.frx":0000
End
Begin VB.PictureBox Picture1
Height = 4900
Left = 1680
ScaleHeight = 4845
ScaleWidth = 6195
TabIndex = 0
Top = 0
Width = 6255
Begin VB.TextBox TxtFrom
Height = 375
Left = 840
TabIndex = 4
Text = "yr"
Top = 480
Width = 2175
End
Begin VB.TextBox TxtTo
Height = 375
Left = 3960
TabIndex = 3
Top = 480
Width = 2175
End
Begin VB.TextBox TxtMsg
Height = 2655
Left = 840
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 2
Top = 1320
Width = 5295
End
Begin VB.CommandButton Command1
Caption = "发送"
Height = 375
Left = 2640
TabIndex = 1
Top = 4200
Width = 1215
End
Begin VB.Label Label1
Caption = "从"
Height = 375
Left = 360
TabIndex = 7
Top = 480
Width = 255
End
Begin VB.Label Label2
Caption = "到"
Height = 375
Left = 3360
TabIndex = 6
Top = 480
Width = 255
End
Begin VB.Label Label3
Caption = "发送内容"
Height = 1095
Left = 360
TabIndex = 5
Top = 1320
Width = 255
End
End
End
Attribute VB_Name = "FormDSystem"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" (Server As Any, yToName As Byte, _
yFromName As Any, yMsg As Byte, ByVal lSize As Long) As Long
Private Function SendMsg(sToUser As String, sFromUser As String, sMessage As String) As Boolean
'sToUser---消息接受方
'sFromUser---消息发送方
'sMessage---要发送的消息
Dim yToName() As Byte
Dim yFromName() As Byte
Dim yMsg() As Byte
Dim l As Long
yToName = sToUser & vbNullChar
yFromName = sFromUser & vbNullChar
yMsg = sMessage & vbNullChar
If NetMessageBufferSend(ByVal 0&, yToName(0), yFromName(0), yMsg(0), UBound(yMsg)) = NERR_Success Then
SendMsg = True
End If
End Function
Private Sub ActiveBarD_ToolClick(ByVal tool As ActiveBar2LibraryCtl.tool)
Select Case tool.Caption
Case "发送消息": Picture1.ZOrder 0
Case "聊天工具": Picture2.ZOrder 0
Default:
End Select
End Sub
Private Sub cmdConnect_Click()
On Error GoTo Errhandler
With Winsock1
.RemoteHost = Trim(txtRemoteIP)
.RemotePort = Trim(txtRemotePort)
If .LocalPort = Empty Then
.LocalPort = Trim(txtLocalPort)
Frame2.Caption = .LocalIP
.Bind .LocalPort
End If
End With
txtLocalPort.Locked = True
StatusBar1.Panels(1).Text = "链接到:" & Winsock1.RemoteHost & " "
Frame1.Enabled = True
Frame2.Enabled = True
Text2.SetFocus
Exit Sub
Errhandler:
MsgBox "Winsock failed to establish connection with remote server", vbCritical
End Sub
Private Sub Command1_Click()
Dim x As Long
x = SendMsg(TxtTo.Text, TxtFrom.Text, TxtMsg.Text)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -