各位高人,小弟在这里请问一下
在资源管理器里,或者浏览器里面,双击文件,根据文件类型的不同会自动调用相应的程序打开,请问这个在VB里有什么方法可以实现?我只知道EXE文件用shell
谢谢~

解决方案 »

  1.   

    用API
    shellexecute (hwnd,"open",filename,true)
      

  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然后在某个控件的click事件中,加入如下代码:
    Call ShellExecute(hwnd, "Open", ExePath & "help.chm", "", App.Path, 1)
      

  3.   

    有关联的 ShellExecute Me.Hwnd, "open", "FileName", "", "", SW_SHOW)
    没有关联的 Shell "Rundll32 runas xxx.xxx", 1