作者:大布丁 | 来源:互联网 | 2023-05-17 18:03
各位:
我在网上搜了一下:
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 Sub Command1_Click()
Call ShellExecute(me.hwnd, "open ", "c:\windows\hh.exe ", vbNullString, vbNullString, &H0)
End Sub
用以上方式提示:错误 1 “hwnd”不是“Customer_Ord_SpaV2.Form1”的成员
于是改成:
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 main()
ShellExecute 0, " ", "a.xls ", " ", "c:\ ", SW_SHOWNORMAL
End Sub
运行过程中报错:无法在 DLL“shell32.dll ”中找到名为“ShellExecuteA ”的入口点。
怎么解决啊?
求各位大侠指点!
3 个解决方案
System.Diagnostics.Process.Start("C:\xx.mdb")文件路径
就可以了