?? frmreceiver.frm
字號:
ScaleHeight = 21
ScaleMode = 3 'Pixel
ScaleWidth = 150
TabIndex = 0
Top = 5520
Width = 2250
End
Begin VB.Timer tmrStatus
Enabled = 0 'False
Interval = 500
Left = 720
Top = 2760
End
Begin MSComDlg.CommonDialog cd1
Left = 13080
Top = 6120
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MBProgressBar.ProgressBar pb
Height = 255
Left = 240
TabIndex = 21
ToolTipText = "接收進度"
Top = 960
Width = 6375
_ExtentX = 11245
_ExtentY = 450
BorderStyle = 1
Value = 1
Percentage = 1
Smooth = -1 'True
BackColor = 15463924
BarStartColor = 8764845
BarEndColor = 16384
TextColor = 16777215
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
BackPicture = "frmReceiver.frx":CD22
BarPicture = "frmReceiver.frx":CD3E
TextAfterCaption= "%"
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Save to:"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 225
Index = 0
Left = 1200
TabIndex = 30
Top = 3600
Width = 855
End
Begin VB.Label Label1
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 = &H00800000&
Height = 225
Index = 7
Left = 240
TabIndex = 24
Top = 1680
Width = 1095
End
Begin VB.Label Label1
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 = &H00800000&
Height = 225
Index = 6
Left = 240
TabIndex = 22
Top = 720
Width = 855
End
Begin VB.Label Label1
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 = &H00800000&
Height = 225
Index = 3
Left = 240
TabIndex = 5
Top = 1320
Width = 855
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "KB/秒"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 225
Index = 4
Left = 2520
TabIndex = 4
Top = 1320
Width = 855
End
Begin VB.Label Label1
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 = &H00800000&
Height = 225
Index = 2
Left = 240
TabIndex = 2
Top = 480
Width = 855
End
End
Attribute VB_Name = "frmReceiver"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
' :) 人人為我,我為人人 :)
'枕善居漢化收藏整理
'發布日期:05/08/03
'描 述:我的網絡聊天室 (客戶端)
'網 站:http://www.mndsoft.com/
'e-mail :mnd@mndsoft.com
'OICQ :88382850
'****************************************************************************
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_PASTE = &H302
'Round the form
Dim rndfrm As New ROUND_FORM
Dim mProgress As Long
Dim mProgressMax As Long
Dim mPercentage As Long
Dim FLAG As Boolean
Private Sub cmdClose_Click()
If pb.Value < 2 Then
Me.Hide
Reader.Reset
Reader.Listen
FLAG = False
udprequest.SendData "RESET"
DoEvents
End If
End Sub
Private Sub cmdSetTarget_Click()
With cd1
.CancelError = True
.Filter = "All File *.*|*.*"
.Flags = cdlOFNOverwritePrompt
.Filename = Reader.CurrentFileName
On Error GoTo OpenError
.ShowSave
txtTarget.Text = .Filename
tmrStatus.Enabled = True
Reader.AcceptSendRequest txtTarget.Text
AddLog "Accepted Send Request at " & Time
AddLog "Saving file to [" & txtTarget.Text & "]"
cmdSetTarget.Enabled = False
End With
Exit Sub
OpenError:
cmdSetTarget.Enabled = True
End Sub
Private Sub Form_Load()
'Set the port for the two data protocol
Reader.LocalPortBinary = 3000
Reader.LocalPortInfo = 1700
Reader.Listen
txtLocalIP.Text = Reader.LocalIP
txtLocalPortInfo.Text = Reader.LocalPortInfo
txtLocalPortBinary.Text = Reader.LocalPortBinary
'round form shape
rndfrm.ROUND_FORM Me, 12, 1, 1
'start udpclose listening for close message
udprequest.Bind 5000
End Sub
Private Sub Reader_ConnectionRequest()
AddLog "Connection Request from [" & Reader.TheWinsock.RemoteHostIP & "]"
End Sub
Private Sub Reader_ReceiveComplete()
tmrStatus.Enabled = False
AddLog "File Receive Complete at " & Time
pb.Value = 0
Reader.ResetFile
mProgress = 0
mProgressMax = 0
mPercentage = 0
lblPercentage.Caption = "100%"
End Sub
Private Sub Reader_ReceiveProgress(ByVal Progress As Long, ByVal ProgressMax As Long)
mProgress = Progress
mProgressMax = ProgressMax
End Sub
Private Sub Reader_SendRequest()
AddLog "Send Request from [" & Reader.TheWinsock.RemoteHostIP & "]"
AddLog "File Name= " & Reader.CurrentFileName
AddLog "File Size(in bytes)= " & Reader.CurrentFileSize
Dim m As Integer
m = MsgBox("A file sending request from " & Reader.TheWinsock.RemoteHostIP & " is made. Do you want to accept it?", vbInformation + vbYesNo)
If m = vbYes Then
txtTotalFileSize.Text = Reader.CurrentFileSize
famReceiveOption.Enabled = True
With cd1
.CancelError = True
.Filter = "All File *.*|*.*"
.Flags = cdlOFNOverwritePrompt
.Filename = Reader.CurrentFileName
On Error GoTo OpenError
.ShowSave
txtTarget.Text = .Filename
tmrStatus.Enabled = True
Reader.AcceptSendRequest txtTarget.Text
AddLog "Accepted Send Request at " & Time
AddLog "Saving file to [" & txtTarget.Text & "]"
cmdSetTarget.Enabled = False
End With
Else
Reader.RefuseSendRequest
Reader.ResetFile
End If
Exit Sub
OpenError:
cmdSetTarget.Enabled = True
End Sub
Sub AddLog(str As String)
txtEventLog.Text = txtEventLog.Text & str & vbCrLf
txtEventLog.SelStart = Len(txtEventLog.Text)
End Sub
Private Sub Reader_SpeedRecord(ByVal Speed As Long)
txtSpeed.Text = Speed
End Sub
Private Sub tmrStatus_Timer()
On Error Resume Next
pb.Max = mProgressMax
pb.Value = mProgress
lblTotalByteReceived.Caption = mProgress
lblPercentage.Caption = (Int(mProgress / mProgressMax * 100) + 1) & "%"
End Sub
Private Sub udprequest_DataArrival(ByVal bytesTotal As Long)
Dim Msg As String
udprequest.GetData Msg
If Right(Msg, 4) = ":FTR" And FLAG = False Then
MESSAGE = MsgBox(Left(Msg, Len(Msg) - 4) & " wants to send a file to you", vbYesNo, "File sending request ...")
If MESSAGE = vbYes Then
FLAG = True
frmReceiver.Visible = True
frmReceiver.txtEventLog.Text = ""
udprequest.SendData "YES"
DoEvents
ElseIf MESSAGE = vbNo Then
udprequest.SendData "NO"
DoEvents
End If
ElseIf FLAG = True Then
udprequest.SendData "NO"
DoEvents
End If
End Sub
Private Sub WindowBorder_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
ReleaseCapture
SendMessage Me.hWnd, &HA1, 2, 0
Exit Sub
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -