vb用createprocess启动其他应用程序
来源:互联网 发布:ibatis框架源码剖析 编辑:程序博客网 时间:2024/05/21 09:37
Option Explicit
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" ( _
ByVal lpApplicationName As String, _
ByVal lpCommandLine As String, _
lpProcessAttributes As SECURITY_ATTRIBUTES, _
lpThreadAttributes As SECURITY_ATTRIBUTES, _
ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, _
lpEnvironment As Any, _
ByVal lpCurrentDriectory As String, _
lpStartupInfo As STARTUPINFO, _
lpProcessInformation As PROCESS_INFORMATION) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
Dim sInfo As STARTUPINFO
Dim psInfo As PROCESS_INFORMATION
Dim pAttr As SECURITY_ATTRIBUTES
Dim tAttr As SECURITY_ATTRIBUTES
Dim nRet As Long
Dim nElapse As Integer
nRet = CreateProcess("C:\Program Files (x86)\360\360zip\360zip.exe", "", pAttr, tAttr, 0, 0, 0, "c:\", sInfo, psInfo)
If nRet = 0 Then Exit Sub
nElapse = 0
While 1 > 0
nRet = WaitForSingleObject(psInfo.hProcess, 1000)
If nRet = 0 Then
MsgBox "Done!"
Exit Sub
End If
Label1.Caption = CStr(nElapse)
nElapse = nElapse + 1
Sleep (1000)
DoEvents
Wend
End Sub
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" ( _
ByVal lpApplicationName As String, _
ByVal lpCommandLine As String, _
lpProcessAttributes As SECURITY_ATTRIBUTES, _
lpThreadAttributes As SECURITY_ATTRIBUTES, _
ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, _
lpEnvironment As Any, _
ByVal lpCurrentDriectory As String, _
lpStartupInfo As STARTUPINFO, _
lpProcessInformation As PROCESS_INFORMATION) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
Dim sInfo As STARTUPINFO
Dim psInfo As PROCESS_INFORMATION
Dim pAttr As SECURITY_ATTRIBUTES
Dim tAttr As SECURITY_ATTRIBUTES
Dim nRet As Long
Dim nElapse As Integer
nRet = CreateProcess("C:\Program Files (x86)\360\360zip\360zip.exe", "", pAttr, tAttr, 0, 0, 0, "c:\", sInfo, psInfo)
If nRet = 0 Then Exit Sub
nElapse = 0
While 1 > 0
nRet = WaitForSingleObject(psInfo.hProcess, 1000)
If nRet = 0 Then
MsgBox "Done!"
Exit Sub
End If
Label1.Caption = CStr(nElapse)
nElapse = nElapse + 1
Sleep (1000)
DoEvents
Wend
End Sub
- vb用createprocess启动其他应用程序
- CreateProcess 启动其他程序
- 用VB 关闭其他应用程序
- IOS--启动其他应用程序
- IOS--启动其他应用程序
- IOS启动其他应用程序
- 启动其他应用程序
- c++中调用其他应用程序的方法winexec shellexecute createprocess
- 用VB来模拟一次菜单操作(其他应用程序)
- WinExec函数,启动其他应用程序
- intent 启动其他应用程序应用
- 启动其他应用程序的组件
- CreateProcess的用法---用于启动一个应用程序(exe可执行文件)
- 在iphone应用程序中启动其他应用程序
- Tip: 如果用其他账号启动本地应用程序
- VB CreateProcess代码
- VC中调用其他应用程序的方法(函数) WinExec,ShellExecute ,CreateProcess
- vc中调用其他应用程序的方法(函数) winexec,shellexecute ,createprocess
- test_and_set_bit()等小函数集合
- 做性能测试,需要一些什么 LoadRunner
- GridView 控件
- xheditor用js提交无法得到textarea 解决方法
- Hibernate Query Language查询
- vb用createprocess启动其他应用程序
- 程序员的十个层次,看看你自己在哪里、、、
- Linux内核参数-共享内存信号量semaphore设置
- Smarty内建函数的学习
- 二叉树
- C#钩子基础
- g++
- 由一个C语言递归判断回文数的程序产生的回忆
- 在Android 中 Draw Bitmap