例如:在程序里用打开对话框打开了一个扩展名为JPG的文件,假设该系统里与JPEG文件相关联的程序为ACDSEE,程序就能自动打开ACDSEE来查看该图像文件.这样的功能如何实现?

解决方案 »

  1.   

    Shell "e:\windows.0\System32\mspaint.exe c:\bmp\eee.jpg", vbNormalFocus换成ACDSEE的路径即可
      

  2.   

    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
    Const SW_SHOWNORMAL = 1
    Private Sub Form_Load()
        ShellExecute Me.hwnd, vbNullString, "c:\bmp\eee.jpg", vbNullString, "C:\", SW_SHOWNORMAL
    End Sub
      

  3.   

    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()
        ShellExecute Me.hwnd, "open", "c:\test.txt", vbNullString, vbNullString, 3
    End Sub