vb.net中如何设计一个监控程序?

vb.net中如何设计一个监控程序?,第1张

以记事本为例

Public Class Form1

Public Sub ShellAndWait(ByVal ProcessPath As String)

Dim objProcess As System.Diagnostics.Process

Try

objProcess = New System.Diagnostics.Process()

objProcess.StartInfo.FileName = ProcessPath

objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal

objProcess.Start()

objProcess.WaitForExit()

objProcess.Close()

Catch

MessageBox.Show("无法执行文件 " &ProcessPath, "错误")

End Try

End Sub

'监视程序悄好拦就可以了,若果监视别的窗体的话,用SPY++ 找到句柄,配合FindWindowEx,SendMessage根启胡据其属性做

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

ShellAndWait("Notepad.exe")

MessageBox.Show("笔记本被关袜液闭后我才会出现")

End Sub

End Class

Dim Cnt As Integer '计数

Dim Tmp As Integer '随机点中郑

Dim JX As Integer '画卖帆颂点轿孙间距

Private Sub Form_Load()

JX = 2

End Sub

Private Sub Timer1_Timer()

Dim Lin As Integer

Dim V1, V2 As Integer

lbNow = Now

'采集数据

Lin = txtData.Text

V1 = (300 - Lin) \ 2 - 5

Randomize

Tmp = Int(Rnd * 200 + 100)

txtData.Text = Tmp

V2 = (300 - Tmp) \ 2 - 5

'采集时间

Cnt = Cnt + 1

txtTime.Text = Cnt

'画坐标

picData.Line (0, 5)-(250, 5), vbRed '280

picData.Line (0, 20)-(250, 20), vbRed '250

picData.Line (0, 35)-(250, 35), vbBlue '220

picData.Line (0, 50)-(250, 50), vbBlue '190

picData.Line (0, 65)-(250, 65), vbBlue '160

picData.Line (0, 80)-(250, 80), vbBlue '130

picData.Line (0, 95)-(250, 95), vbBlue '100

'画图

picData.Line (JX * Cnt, V2)-(JX * Cnt - 1, V1), vbBlack

End Sub

如需源代码可以发给你。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12288096.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-24
下一篇 2023-05-24

发表评论

登录后才能评论

评论列表(0条)

保存