如何利用VB Script或批处理做一个能连续依次运行应用程序的东西

如何利用VB Script或批处理做一个能连续依次运行应用程序的东西,第1张

@echo off

For /r %%i in (exe) do start /wait "" "%%i"

pause

::有/wait参数就会执行完一个exe才会执行下一个

用MessageBox代替MsgBox

Private Declare Function MessageBox Lib "user32dll" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long

Private Sub Command1_Click()

Timer1Interval = 1000

MessageBox hwnd, "消息文本", "标题", 64

End Sub

Private Sub Timer1_Timer()

Cls

Print Now

Print "时间还在走"

End Sub

Private Sub Command2_Click()

MsgBox "现在再看呢", 64, "还走吗"

End Sub

初始设置:(一个文本框,一个标签,一个定时器)

文本框:Text1text的初值在控件属性中设置成10

定时器:Time1Interval属性:1000,Time1Enabled属性:True

标 签:Label1Caption属性:计时10秒

程序:

Dim A As Integer

Private Sub Form_Load()

A = 3600

End Sub

Private Sub Timer1_Timer()

If Text1Text <> 0 Then

Text1Text = Val(Text1Text) - 1

Else

A = A - 1

Label1Caption = "暂停1小时"

If A = 0 Then

Text1Text = 10

A = 3600

Label1Caption = "继续计时"

End If

End If

End Sub

以下以 记事本 和 注册表编辑器 为例:

Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long

Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long

Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Private Const PROCESS_TERMINATE = 1

Private Sub Form_Load()

Timer1Interval = 15000

End Sub

Private Sub Timer1_Timer()

Static b As Boolean, pid As Integer

Dim lProcess As Long

lProcess = OpenProcess(PROCESS_TERMINATE, False, pid)

TerminateProcess lProcess, 1

CloseHandle lProcess

b = Not b

pid = Shell(IIf(b, "notepad", "regedit"), vbNormalFocus)

End Sub

以上就是关于如何利用VB Script或批处理做一个能连续依次运行应用程序的东西全部的内容,包括:如何利用VB Script或批处理做一个能连续依次运行应用程序的东西、vb中d出消息框如何能不中断程序的运行、vb如何实现一个程序先运行10s,然后停止1小时后,再继续运行一个小时,如此循环下去等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

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

原文地址: http://outofmemory.cn/zz/10120890.html

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

发表评论

登录后才能评论

评论列表(0条)

保存