VB中如何使用通用对话框打开world?
1个回答
展开全部
Option Explicit
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()
Dim f
With CreateObject("UserAccounts.CommonDialog")
.Filter = "doc File|*.doc": .InitialDir = "d:\"
f = .ShowOpen
If f Then ShellExecute Me.hwnd, "open", .FileName, "", "", 5
End With
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 Command1_Click()
Dim f
With CreateObject("UserAccounts.CommonDialog")
.Filter = "doc File|*.doc": .InitialDir = "d:\"
f = .ShowOpen
If f Then ShellExecute Me.hwnd, "open", .FileName, "", "", 5
End With
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询