ShellExecute函数为什么选择了打开文件后就不能打开同目录的exe文件??

2024-12-25 17:52:14
推荐回答(4个)
回答1:

应用程序修改了本身默认的目录路径。
建议用GetMOduleFileName获取程序路径。

回答2:

改用 ShellExecute 函数绝对可以..!!

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL = 1

Private Sub Command1_Click()
Dim pth As String
pth = "X:\3Dfile\3D.exe" '//程序路径
ShellExecute Me.hwnd, "open", pth, "", "", 1
End Sub

回答3:

希望你在这里可以找到你要解决的问题:http://baike.baidu.com/view/1044533.htm

回答4:

打开后 看下 SE_ERR_DDEBUSY