VB中如何使双进程互相监控、运行●●●●只要有代码测试成功就给分
来源:百度知道 编辑:UC知道 时间:2024/06/03 15:04:08
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal
lpWindowName As String) As Long
Private Sub Form_Load()
Me.Caption = "小强"
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
If FindWindow(vbNullString, "旺财") = 0 Then Shell "旺财.exe", vbNormalFocus
End Sub
'用以上代码生成“小强.exe”
'=========================================================================
'用以下代码生成“旺财.exe”
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal
lpWindowName As String) As Long
Private Sub Form_Load()
Me.Caption = "旺财"
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
If FindWindow(vbNullString, "小强") = 0 Then Shell "小强.exe", vbNormalFocus
End