VB等待进程结束

编程之家收集整理的这篇文章主要介绍了VB等待进程结束编程之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

VB运行EXE程序,并等待其运行结束 参考:https://blog.csdn.net/useway/article/details/5494084 Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Pr

VB运行EXE程序,并等待其运行结束

参考https://blog.csdn.net/useway/article/details/5494084

Private Declare Function WaitForSingleObject lib "kernel32" (ByVal hHandle As Long,ByVal DWMilliseconds As Long) As Long
Private Declare Function CloseHandle lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function OpenProcess lib "kernel32" (ByVal DWDesiredAccess As Long,ByVal binheritHandle As Long,ByVal DWProcessID As Long) As Long
Private Sub Command1_Click()
    Dim i As Long
    Dim r As Long
    Dim p As Long
    i = Shell("NOTEPAD.EXE",vbnormalFocus)
    p = OpenProcess(&H100000,False,i)
    r = WaitForSingleObject(p,-1)
    r = CloseHandle(p)
    MsgBox "记事本已经关闭"
End Sub

VB运行批处理文件,并等待其运行结束

参考http://blog.sina.com.cn/s/blog_7a44d6090100xdvf.HTML

Private Declare Function OpenProcess lib "kernel32" (ByVal DWDesiredAccess As Long,ByVal DWProcessID As Long) As Long
Private Declare Function GetExitCodeProcess lib "kernel32" (ByVal hProcess As Long,lpExitCode As Long) As Long
Private Declare Function CloseHandle lib "kernel32" (ByVal hObject As Long) As Long
Private Sub Command1_Click()
    Dim pID As Long
    Dim ExitCode as Long
    pID = Shell("c:\a.bat",vbnormalFocus)
    hProcess = OpenProcess(&H400,0,pID)
    Do
        Call GetExitCodeProcess(hProcess,ExitCode)
        DoEvents
    Loop While ExitCode = &H103
    Call CloseHandle(hProcess)
    MsgBox ("运行结束")
End Sub

总结

以上是编程之家为你收集整理的VB等待进程结束全部内容,希望文章能够帮你解决VB等待进程结束所遇到的程序开发问题。

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。

VB文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强制返回为文本 -------------------------------- 数字类型的格式化 --------------------------------     固定格式参数:     General Number 普通数字,如可以用来去掉千位分隔号     format$("100,1
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办法, Format 或者FormatDateTime 竟然结果和系统设置的区域语言的日期和时间格式相关。意思是尽管你用诸如 Format(Now, "MM/dd/yyyy"),如果系统的设置格式区域语言的日期和时间格式分隔符是"-",那他还会显示为 MM-dd-yyyy     只有拼凑: <%response.write
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用的爽呀,这篇文章写与2011年,看来我以前没有认真去找这个方法呀。 https://blog.csdn.net/chzjxgd/article/details/6176325 金蝶K3 BOS的插件官方是用VB6编写的,如果  能用.Net下的语言工具开发BOS插件是一件很愉快的事情,其中缘由不言而喻,而本文则是个人首创,实现在了用V
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选中的单元格进行处理 Dim m As Range, tmpStr As String, s As String Dim x As Integer, y As Integer, subStr As String If MsgBox("确定要分列处理吗?请确定分列的数据会覆盖它后面的单元格!", _
  Imports MySql.Data.MySqlClient Public Class Form1 ‘ GLOBAL DECLARATIONS Dim conString As String = "Server=localhost;Database=net2;Uid=root;Pwd=123456;" Dim con As New MySqlConnection
‘導入命名空間 Imports ADODB Imports Microsoft.Office.Interop   Private Sub A1() Dim Sql As String Dim Cnn As New ADODB.Connection Dim Rs As New ADODB.Recordset Dim S As String   S = "Provider=OraOLEDB.Oracl
VB运行EXE程序,并等待其运行结束 参考:https://blog.csdn.net/useway/article/details/5494084 Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Pr
今天碰到一个问题,登陆的时候,如果不需要验证手机号为空,则不去验证手机号 因为登陆的时候所有的验证信息都存放在一个数组里 Dim CheckUserInfo() As String ={UserBirthday, SecEmail, UserMob, UserSex, RealNameFirst, RealName, CheckCardID, CheckCardType, Contactemail
微信公众号搜索 “ 程序精选 ” ,选择关注!
微信公众号搜 "程序精选"关注