VB中怎么实现command单击打开text中输入的文件名而对应的文件
本人新手,如题,我创建了一个text框和一个command框,实现的预期结果是这样,在text中输入cmd.exe,单击command就可以打开c:\VBVB66\cmd...
本人新手,如题,我创建了一个text框和一个command框,实现的预期结果是这样,在text中输入cmd.exe,单击command就可以打开c:\VBVB66\cmd 以下是我写的代码,大神看看为什么不对呢,好纠结。
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 Command8_Click()
ShellExecute Me.hwnd, "open", "C:\VBVB66\" & Text1.Text, vbNullString, vbNullString, 1
End Sub
附图片:
求大神指导 展开
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 Command8_Click()
ShellExecute Me.hwnd, "open", "C:\VBVB66\" & Text1.Text, vbNullString, vbNullString, 1
End Sub
附图片:
求大神指导 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询