3

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

Simsons
  • 12,295
  • 42
  • 153
  • 269

1 Answers1

2

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

tenfour
  • 36,141
  • 15
  • 83
  • 142
  • Can I get just the parameter passed from ShellExecute, GetCommandLine returns the path and parameter both – Simsons Nov 30 '10 at 12:49