Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Killing a shellexecuted process

Status
Not open for further replies.

sirugo

Programmer
Aug 1, 2000
162
0
0
SE
I'm initiating a process using Shellexecute (C++).
The I want to kill the process.
How do I do that?

 
I don't see a way in the MSDN documentation for ShellExecute().
Try using CreateProcess() and TerminateProcess().
 
OK, but what I actually need is to execute Internet Explorer with a url specified.

Can this be done with CreateProcess?
How?
 
Did you read the MSDN info about CreateProcess()?
Here's a simple example that works for me:
Code:
#include <windows.h>
#include <iostream>
using namespace std;


int main()
{
	PROCESS_INFORMATION processInfo;
	STARTUPINFO startInfo;

	startInfo.lpReserved	= NULL;
	startInfo.lpDesktop		= "";
	startInfo.lpTitle		= NULL;
	startInfo.dwFlags		= 0;
	startInfo.cbReserved2	= 0;
	startInfo.lpReserved2	= NULL;

	if ( CreateProcess( NULL,
						"\"C:\\Program Files\\Internet Explorer\\iexplore.exe\" [URL unfurl="true"]http://www.cnn.com/",[/URL]
						NULL,
						NULL,
						FALSE,
						0,
						NULL,
						NULL,
						&startInfo,
						&processInfo ) == FALSE )
	{
		cout << endl << "CreateProcess() failed!" << endl;
	}

	return 0;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top