求解:(VB6.0)如何在程序中调用打开PDF文件?
(VB6.0)如何通过点击界面中的Command打开指定的PDF文件(注:数据库中又该如何进行关联呢?通过保存文件路径来进行关联吗?)希望能给出详细操作的流程和思路,有源...
(VB6.0)如何通过点击界面中的Command打开指定的PDF文件(注:数据库中又该如何进行关联呢?通过保存文件路径来进行关联吗?)希望能给出详细操作的流程和思路,有源代码的最好了,谢谢!
展开
1个回答
展开全部
下面的代码是调用系统默认程序打开PDF,注意修改文件路径D:\help.pdf
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 result
result = ShellExecute(0, vbNullString, "D:\help.pdf", vbNullString, vbNullString, SW_SHOWNORMAL)
If result <= 32 Then
MsgBox "打开失败!", vbOKOnly + vbCritical, "错误:", 0
End If
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 Const SW_SHOWNORMAL = 1
Private Sub Command1_Click()
Dim result
result = ShellExecute(0, vbNullString, "D:\help.pdf", vbNullString, vbNullString, SW_SHOWNORMAL)
If result <= 32 Then
MsgBox "打开失败!", vbOKOnly + vbCritical, "错误:", 0
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询