控制网络流量规则变化并输出波形——NetWaveOutput
ldc 2008-12-20软件综合
看到dotos同志写的CPUWaveOutput,感觉很是强大,于是用VB做了这个模仿品。这个是控制网络流量的,在任务管理器里的“联网”可以看到曲线图像。
实验证明在输出图像前关掉所有使用网络的程序和占用较多CPU资源的后台程序后能得到很好的图像效果。
12066

正弦波

12067

锯齿波

12068

方波

12069

三角波
+2500  科创币    93°   2008-12-20    发布源码,鼓励……
来自 软件综合
 
2008-12-20 18:34:00
ldc(作者)
1楼
折叠评论
加载评论中,请稍候...
折叠评论
ldc(作者)
2楼
向dotos同志学习,公布源码。

Option Explicit
Dim Data(1 To 256) As Byte
Dim XiangWei As Double
Dim DataLenth As Integer
Const PI = 3.14159265

Private Sub Command1_Click()
XiangWei = 0
If Option1.Value = True Then
    XiangWei = (3 / 2) * PI
End If
Timer1.Enabled = True
Frame1.Enabled = False
Command1.Enabled = False
Command2.Enabled = True
Label2.Visible = True
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
Frame1.Enabled = True
Command1.Enabled = True
Command2.Enabled = False
Label2.Visible = False
End Sub

Private Sub Form_Load()
Dim i As Integer
For i = 1 To 256
    Data(i) = i - 1
Next i
End Sub

Private Sub ImageOut(ByVal Times As Integer)
Dim i As Integer
For i = 1 To Times
    Winsock1.SendData Data
Next i
DataLenth = Times
End Sub

Private Sub Timer1_Timer()
If Option1.Value = True Then
    '******正弦波*****
    Call ImageOut(Int((Sin(XiangWei) + 1) * 40))
    XiangWei = XiangWei + PI / 150
ElseIf Option2.Value = True Then
    '******据齿波*******
    Call ImageOut(Int(((XiangWei + 30) Mod 30) * 4))
    XiangWei = XiangWei + 0.1
ElseIf Option3.Value = True Then
    '******方波*******
    If XiangWei Mod 30 > 15 Then Call ImageOut(80) Else Call ImageOut(0)
    XiangWei = XiangWei + 0.1
ElseIf Option4.Value = True Then
    '******三角波*******
    If XiangWei Mod 30 <= 15 Then
        Call ImageOut(Int(XiangWei Mod 30) * 4)
    Else
        Call ImageOut((30 - Int(XiangWei Mod 30)) * 4)
    End If
    XiangWei = XiangWei + 0.1
End If
Label2.Caption = DataExchange(DataLenth * 256) & "/s"
End Sub

Private Function DataExchange(ByVal Datee As Long) As String
On Error Resume Next
If Datee <= 1024 Then
    DataExchange = Str(Datee) & "Byte"
    Exit Function
End If
If Datee > 1204 And Datee < 1048576 Then
    DataExchange = Str(Int(Datee / 1024)) & "KB"
    Exit Function
End If
DataExchange = Format(Datee / 1048576, "#########.##") & "MB"
End Function
折叠评论
加载评论中,请稍候...
折叠评论

想参与大家的讨论?现在就 登录 或者 注册

ID:{{user.uid}}
{{user.username}}
{{user.info.certsName}}
{{user.description}}
{{format("YYYY/MM/DD", user.toc)}}注册,{{fromNow(user.tlv)}}活动
{{submitted?"":"投诉"}}
请选择违规类型:
{{reason.description}}
支持的图片格式:jpg, jpeg, png