我已经得到一个文件的绝对路径,文件的格式不固定,我就是想他自动调用系统默认的程序打开,谁有类似的代码,谢谢

解决方案 »

  1.   

    系统默认,那可能要用到系统的控件,WINDOWS 应该就要调用DLL
      

  2.   

    if (扩展名.equals("doc")){
      按doc文件打开(filename);
    }
    else if (扩展名.equals("ppt")){
      按ppt文件打开(filename);
    }
    else if ......
    ......
    ......
    ......
      

  3.   

    This method allows you to execute any commands in a folder's shortcut menu or stored in the registry.To open a folder, use either of the following calls: ShellExecute(handle, NULL, <fully_qualified_path_to_folder>, NULL, NULL, SW_SHOWNORMAL);or ShellExecute(handle, "open", <fully_qualified_path_to_folder>, NULL, NULL, SW_SHOWNORMAL);
    from MSDN