易截截图软件、单文件、免安装、纯绿色、仅160KB

各位高手请问如何使用VB关闭其他应用程序

在VS2008中,我用shell打开了powerpoint,请问怎么样使用VB再关闭打开的这个powerpoint,示范具体的API,谢谢!
0)
End If
Loop While (ProcessNext(hSnapShot, pe32))
CloseHandle (hSnapShot)
GetTargetProcessID = dwRet
End Function

Private Function CloseTargetProcess(ByVal dwProcessID As Long) As Boolean
Dim hProcess As Long
Dim lpExitCode As Long
hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, dwProcessID)
If hProcess = 0 Then
CloseTargetProcess = False
Exit Function
End If
If GetExitCodeProcess(hProcess, lpExitCode) = 0 Then
CloseTargetProcess = False
Exit Function
End If
If TerminateProcess(hProcess, lpExitCode) = 0 Then
CloseTargetProcess = False
Else
CloseTargetProcess = True
End If
CloseHandle (hProcess)
End Function
Private Function CloseProcess(ProcessName As String)
On Error Resume Next
Dim ret As Long
ret = GetTargetProcessID(ProcessName)
If ret <> 0 Then
ret = CloseTargetProcess(ret)
End If
End Function


'调用
Call CloseProcess("powerpoint.exe") '这里的进程名必须一致.  大小写都要一样



谢谢了,不过好像你说的那些不是VS2008中的,系统都不认识这些OpenProcess等等的

不会VB的人员路过!帮顶!

VB code



Code highl


相关问答:

【急求】VB中使用WScript调用外部命令 - VB / 基础类

在下是vb的新手,想写段程序,在vb中,使用wscript调用一些外部的命令,但是程序执行一直有错误,请各位高手帮忙解答下,谢谢。
代码如下:
VB code:

Private Function getFile_CMD(filename, filepath) As Bo ......

帮我改改这VB题 - VB / 基础类

帮我改改 我总觉得有问题
Type ID
  number As Single
  score As Integer
  name As String * 6
End Type
Dim personl As ID, i%
Private Sub Command1_Click()
 i = 0
&nbs ......

vb超简单form.show的问题 - VB / 非技术类

为什么我用form.show和form.hide多次连接了两个窗口只能互换链接两次啊?
代码看看
照道理form.show 没次数限定的吧

我也快疯了。
楼主知道怎么发贴么?

引用
我也快疯了。
楼主知道怎么发贴么?
楼主也 ......

vb - VB / 基础类

我想把word另存为xml之后,用vb读取这个xml的内容,请问如何实现?
dim f as integer
dim b() as byte
dim s as string
dim L as long
f=freefile()
open "abc.xml" for binary access read as #f
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号