为什么我们需要用 ShellExecute 传递 LPCTSTR lpParameters

发布于 2024-10-04 18:32:46 字数 746 浏览 0 评论 0原文

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);

我可以在第四个参数中传递一些内容,即: lpParameters ,以便我可以使用 MyApp.Exe 处理这个问题,假设我在第四个参数中传递“Hi:

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

我可以签入我的应用 。

程序吗?”我尝试使用 POSTMESSAGE ,但对 shellexecute 没有帮助

Shell Execute has the following signature :

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

How can we use lpParameters , Can we handle the parameter in my application. I am executing my app as below:

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

Can I pass something in the 4th parameter i.e: lpParameters , so that I can handle this with MyApp.Exe , let's say if I am passing "Hi: in the 4th param:

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

Can I check in my application whether it is hi and display a message high.

I tried with POSTMESSAGE , but is not helpful with shellexecute

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

土豪 2024-10-11 18:32:46

lpParameters 将在命令行中出现。使用 GetCommandLine() 来查看它。

lpParameters will come through in the command line. Use GetCommandLine() to see it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文