0

First I open web browser using shellexecute command. then How we can get close event of browser using MFC/VC++/C++?

Vijay Kumbhani
  • 726
  • 6
  • 24

1 Answers1

0

From MSDN:

To obtain information about the application that is launched as a result of calling ShellExecute, use ShellExecuteEx.

And a quick lookup on stackoverflow gives this question, whose answer I quote here:

SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "c:\\MyProgram.exe";        
ShExecInfo.lpParameters = "";   
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL; 
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
Community
  • 1
  • 1
Johan
  • 3,603
  • 12
  • 24