代码之家  ›  专栏  ›  技术社区  ›  Simsons

为什么我们需要用shellexecute传递lpctstr lpparameters

  •  2
  • Simsons  · 技术社区  · 14 年前

    shell execute具有以下签名:

    HINSTANCE ShellExecute(
      __in_opt  HWND hwnd,
      __in_opt  LPCTSTR lpOperation,
      __in      LPCTSTR lpFile,
      __in_opt  LPCTSTR lpParameters,
      __in_opt  LPCTSTR lpDirectory,
      __in      INT nShowCmd
    );
    

    如何使用lpparameters,我们可以在我的应用程序中处理参数吗?我正在执行应用程序,如下所示:

    HINSTANCE hShellExecuteStatus = ShellExecute(NULL, "open", "MyPath/MyApp.EXE", NULL, NULL, SW_SHOWNORMAL);
    

    我能在第4个参数中传递一些东西吗?例如:lpparameters,这样我就可以用myapp.exe来处理这个问题了,假设我正在传递“hi:in the 4th param:

    HINSTANCE hShellExecuteStatus = ShellExecute(NULL, "open", "MyPath/MyApp.EXE", "Hi", NULL, SW_SHOWNORMAL);
    

    我可以检查一下我的应用程序是否为hi并显示一条信息high吗?

    我试过发邮件,但对shellexecute没有帮助

    1 回复  |  直到 14 年前
        1
  •  2
  •   tenfour    14 年前

    lpParameters 将通过命令行。使用 GetCommandLine() 去看看。

    推荐文章