控制其他软件运行
2011-07-26 03:16
295 查看
Option Explicit
'Download by http://www.codefans.net
' Shows how to shell to another program, and wait until it finishes
' before continuing.
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 Const INFINITE = -1&
Private Const SYNCHRONIZE = &H100000
Private Sub Command1_Click()
Dim iTask As Long, ret As Long, pHandle As Long
iTask = Shell("notepad.exe", vbNormalFocus)
pHandle = OpenProcess(SYNCHRONIZE, False, iTask)
ret = WaitForSingleObject(pHandle, INFINITE)
ret = CloseHandle(pHandle)
MsgBox "³ÌÐòÔËÐÐÍê³É!"
End Sub
'Download by http://www.codefans.net
' Shows how to shell to another program, and wait until it finishes
' before continuing.
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 Const INFINITE = -1&
Private Const SYNCHRONIZE = &H100000
Private Sub Command1_Click()
Dim iTask As Long, ret As Long, pHandle As Long
iTask = Shell("notepad.exe", vbNormalFocus)
pHandle = OpenProcess(SYNCHRONIZE, False, iTask)
ret = WaitForSingleObject(pHandle, INFINITE)
ret = CloseHandle(pHandle)
MsgBox "³ÌÐòÔËÐÐÍê³É!"
End Sub
相关文章推荐
- java 物理地址校验软件试用版控制问题以及非法拷贝到其他机子上运行
- 在域模式中控制客户端运行和禁止软件 推荐
- 软件移植到其他电脑运行无反应
- Android 判断软件app是否运行在bluestacks模拟器上(或者其他模拟器)
- 通过注册表控制软件可否运行
- Winform登录、控制软件只运行一次、回车登录
- 【IDE-Visual Studio】visual Studio(vs)经常在操作,测试中运行中未响应,cpu使用达到100%,导致其他软件、浏览器等卡死
- 怎么通过应用程序控制策略限制软件运行?(转载)
- 控制外部软件的启动及运行,如何将它的闪现窗体也隐藏呢?
- vc2005/2008编写的软件无法在其他机子上运行问题的解决方案
- 通过本地安全策略中的应用程序控制策略限制软件运行
- 实验:基本的系统安全控制 实验环境 某公司新增了一台企业级服务器,已安装运行RHEL 6操作系统,由系统运维部、软件开发部、技术服务部共同使用。由于用户数量众多,且使用时间不固定,要求针对账号和
- 控制其他应用软件
- 软件调试笔记67 - WinDBG用法详解 :控制进程和线程
- java执行其他软件的命令
- 开题报告、文献综述、外文翻译、论文反抄袭软件、论文目录,就差论文正文了,其他都全了!!
- 12.最快、最好用的远程控制软件 - Radmin
- 做一个运动控制软件开发人员需要具备的条件!
- 有关软件开发中svn(项目控制软件)版本恢复的问题
- 如何将自己编写的软件放在真机上运行(ios证书相关的)