请教如何在eVB中打开一个带格式的文件,并启动相应的应用程序进行浏览查看。比如.doc文件启动Word; 或者.pdf启动Acrobat Reader等!如能蒙赐教,定有高分相送!最好能付上源代码!不胜感激!!

解决方案 »

  1.   

    void ShellExec(LPCTSTR action,LPCTSTR filepath,LPCTSTR param,UINT show)
    { SHELLEXECUTEINFO shellinfo;
    HINSTANCE hInst;
    shellinfo.cbSize = sizeof(SHELLEXECUTEINFO);
    shellinfo.fMask = SEE_MASK_CLASSNAME;
    shellinfo.hwnd = NULL;
    shellinfo.lpVerb = action;
    shellinfo.lpFile = filepath;//Acrobat Reader等
    shellinfo.lpParameters = param;//你要打开的文件路径
    shellinfo.lpDirectory = NULL;   
    shellinfo.nShow = show;
    shellinfo.hInstApp = hInst;
    shellinfo.hProcess = NULL; ShellExecuteEx(&shellinfo);}
      

  2.   

    ShellExecuteEx这个api,evb好像不支持,你可以在evc中写个dll在evb中调用
      

  3.   


    使用以下代码:
    shell "cmd /c 文件名",vbhide
    注意:文件名最好用引号扩起来,这样文件名中可带空格