请问诸位高人,我用ShellExecute打开了一个文本文件,现在想让文本文件显示在屏幕上,不知如何办到,请赐教!

解决方案 »

  1.   

    ShellExecute(NULL, "open", "c:\\1.txt", NULL, NULL, SW_SHOWNORMAL);它不就显示了吗?
      

  2.   

    请问,为什么我在第二个NULL的地方换成路径就不行了呢?Thanks
      

  3.   

    HINSTANCE ShellExecute(
        HWND hwnd, 
        LPCTSTR lpOperation,
        LPCTSTR lpFile, 
        LPCTSTR lpParameters, 
        LPCTSTR lpDirectory,
        INT nShowCmd
    );楼主说的第二个null是第几个参数? 第四个吗?
    第四个参数的说明:
    lpParameters 
    If the lpFile parameter specifies an executable file, lpParameters is an address to a null-terminated string that specifies the parameters to be passed to the application. 
    If lpFile specifies a document file, lpParameters should be NULL.
      

  4.   

    ShellExecute(NULL, "open", "notepad.exe", "c:\\1.txt", NULL, SW_SHOWNORMAL);
      

  5.   

    ShellExecute
    Performs an operation on a specified file. 这个函数是对一个特定的文件进行特定的操作,搂主说的第二个NULL是指lpDirectory他只是描述一个默认的目录而已,怎么可能打开文件?lpDirectory 
    Address of a null-terminated string that specifies the default directory.
      

  6.   

    如果lpFile指定了路径,lpDirectory将被忽略,如果lpFile只有文件名,将使用lpDirectory目录中的文件,如果lpDirectory如果为空,将使用程序运行的当前目录作为默认目录。