Click here to Skip to main content
15,896,606 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: the date time picker control Pin
Chandrasekharan P31-Mar-09 18:22
Chandrasekharan P31-Mar-09 18:22 
GeneralRe: the date time picker control [modified] Pin
alphaxz31-Mar-09 19:42
alphaxz31-Mar-09 19:42 
GeneralRe: the date time picker control Pin
Chandrasekharan P31-Mar-09 19:46
Chandrasekharan P31-Mar-09 19:46 
AnswerRe: the date time picker control Pin
aks.31-Mar-09 21:22
aks.31-Mar-09 21:22 
QuestionTerminateProcess() Pin
gamefreak229131-Mar-09 12:56
gamefreak229131-Mar-09 12:56 
AnswerRe: TerminateProcess() Pin
Joe Woodbury31-Mar-09 13:04
professionalJoe Woodbury31-Mar-09 13:04 
GeneralRe: TerminateProcess() Pin
gamefreak229131-Mar-09 13:12
gamefreak229131-Mar-09 13:12 
GeneralRe: TerminateProcess() Pin
Joe Woodbury31-Mar-09 13:38
professionalJoe Woodbury31-Mar-09 13:38 
DWORD ExecuteProcess(LPCTSTR pCommandLine, LPCTSTR pDirectory = NULL, DWORD millisecondsTimeout = INFINITE)
{
	// _alloca allocates the memory on the stack, so I don't need to worry about cleaning it up
	// You could use new and then delete the buffer later
	TCHAR* pCmdLine = (TCHAR*) _alloca((lstrlen(pCommandLine) + 1) * sizeof(TCHAR));
	lstrcpy(pCmdLine, pCommandLine);

	STARTUPINFO startupInfo;
	memset(&startupInfo, 0, sizeof(startupInfo));
	startupInfo.cb = sizeof(startupInfo);

	PROCESS_INFORMATION processInfo;
	memset(&processInfo, 0, sizeof(processInfo));

	DWORD rval;

	if (CreateProcess(NULL, pCmdLine, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, pDirectory, &startupInfo, &processInfo))
	{
		rval = WaitForSingleObject(processInfo.hProcess, millisecondsTimeout);
	}
	else
	{
		rval = GetLastError();
	}

	CloseHandle(processInfo.hProcess);
	CloseHandle(processInfo.hThread);

	return rval;
}



Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke


GeneralRe: TerminateProcess() Pin
gamefreak229131-Mar-09 20:14
gamefreak229131-Mar-09 20:14 
GeneralRe: TerminateProcess() Pin
Iain Clarke, Warrior Programmer31-Mar-09 22:50
Iain Clarke, Warrior Programmer31-Mar-09 22:50 
GeneralRe: TerminateProcess() Pin
Joe Woodbury1-Apr-09 5:28
professionalJoe Woodbury1-Apr-09 5:28 
AnswerRe: TerminateProcess() Pin
gamefreak229131-Mar-09 20:20
gamefreak229131-Mar-09 20:20 
GeneralRe: TerminateProcess() Pin
Stuart Dootson31-Mar-09 20:29
professionalStuart Dootson31-Mar-09 20:29 
RantRe: TerminateProcess() Pin
Iain Clarke, Warrior Programmer31-Mar-09 22:58
Iain Clarke, Warrior Programmer31-Mar-09 22:58 
Questiontapi Pin
Member 47646831-Mar-09 8:38
Member 47646831-Mar-09 8:38 
AnswerRe: tapi Pin
Joe Woodbury31-Mar-09 9:47
professionalJoe Woodbury31-Mar-09 9:47 
GeneralRe: tapi Pin
Member 4764681-Apr-09 6:45
Member 4764681-Apr-09 6:45 
GeneralRe: tapi Pin
Joe Woodbury1-Apr-09 8:38
professionalJoe Woodbury1-Apr-09 8:38 
GeneralRe: tapi Pin
Member 4764682-Apr-09 4:45
Member 4764682-Apr-09 4:45 
QuestionRe: tapi Pin
David Crow1-Apr-09 3:31
David Crow1-Apr-09 3:31 
AnswerRe: tapi Pin
Member 4764681-Apr-09 6:47
Member 4764681-Apr-09 6:47 
QuestionRe: tapi Pin
David Crow1-Apr-09 7:15
David Crow1-Apr-09 7:15 
QuestionMultiple Inheritance question Pin
ForNow31-Mar-09 6:41
ForNow31-Mar-09 6:41 
AnswerRe: Multiple Inheritance question Pin
Stuart Dootson31-Mar-09 7:10
professionalStuart Dootson31-Mar-09 7:10 
GeneralRe: Multiple Inheritance question Pin
ForNow31-Mar-09 16:24
ForNow31-Mar-09 16:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.