VB运行exe问题

来源:百度知道 编辑:UC知道 时间:2024/05/21 19:58:32
我想建个"按钮"
运行C:\Program Files\Common Files\Microsoft Shared\Speech\abc.exe

但我不想通过用shell C:\Program Files\Common Files\Microsoft Shared\Speech\abc.exe的方法实现,刚才有人提示我说运用API函数

麻烦高手 帮我写下完整的代码,假如你要实现上面的问题,你怎么写,不要用shell.
答非所问的 不采纳答案!谢谢

你以为大家在上面回答问题都是为了被采纳或者为了分数?

问问题的话就象个问问题的样子,没人求着为你回答的,大家回答问题是为了相互交流,而不是只为了得到自己所需要的答案!在这里,请你摆正位置

关于你运行程序的问题,你可以用这个函数

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

是我昨天回答你的问题的。

完整的方法:

前面的声明中写:
Declare Function WinExec Lib "kernel32" Alias "WinExec" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) As Long

在一个按钮中写:

winexec "C:\Program Files\Common Files\Microsoft Shared\Speech\abc.exe",10

就这么简单