Click here to Skip to main content
15,889,724 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: COM dll that uses Windows7 libraries on XP Pin
TheGreatAndPowerfulOz28-Sep-11 9:10
TheGreatAndPowerfulOz28-Sep-11 9:10 
GeneralRe: COM dll that uses Windows7 libraries on XP Pin
Al_Pennyworth28-Sep-11 9:23
Al_Pennyworth28-Sep-11 9:23 
GeneralRe: COM dll that uses Windows7 libraries on XP Pin
TheGreatAndPowerfulOz28-Sep-11 9:27
TheGreatAndPowerfulOz28-Sep-11 9:27 
AnswerRe: COM dll that uses Windows7 libraries on XP Pin
Randor 28-Sep-11 19:50
professional Randor 28-Sep-11 19:50 
QuestionTodays Question, ShellExecute using - start /w pkgmgr.exe /iu: Pin
jkirkerx28-Sep-11 7:20
professionaljkirkerx28-Sep-11 7:20 
AnswerRe: Todays Question, ShellExecute using - start /w pkgmgr.exe /iu: Pin
TheGreatAndPowerfulOz28-Sep-11 7:32
TheGreatAndPowerfulOz28-Sep-11 7:32 
GeneralRe: Todays Question, ShellExecute using - start /w pkgmgr.exe /iu: Pin
jkirkerx28-Sep-11 8:03
professionaljkirkerx28-Sep-11 8:03 
GeneralRe: Todays Question, ShellExecute using - start /w pkgmgr.exe /iu: Pin
jkirkerx28-Sep-11 9:49
professionaljkirkerx28-Sep-11 9:49 
I didn't like the cmd window hanging there with a blinking cursor, Although it did the job.

I added the CoIntialize to the Shell Execute, and it grabs the process, and doesn't let go until the pkgmgr.exe completes now. Before it just came back after the program started running. Now I just need to add the exitCode stuff in case it fails for some reason, and check the errorlevel code at the end.

I'm going to leave it at this for now.


//Execute the Program in the shell
	SHELLEXECUTEINFO lpExecInfo = {0};
	lpExecInfo.cbSize  = sizeof(SHELLEXECUTEINFO);
	lpExecInfo.lpFile = lp_File; 
	lpExecInfo.fMask = SEE_MASK_DOENVSUBST|SEE_MASK_NOCLOSEPROCESS ;     
	lpExecInfo.hwnd = NULL;  
	lpExecInfo.lpVerb = lp_Operation; 
	lpExecInfo.lpParameters = lp_Parameters; 
	lpExecInfo.lpDirectory = lp_Directory;   
	lpExecInfo.nShow = SW_SHOW ;  
	lpExecInfo.hInstApp = (HINSTANCE) SE_ERR_DDEFAIL ;

	//Instialize the Comm Pointer first
	hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
	if ( FAILED( hr ) ) {		
		CoUninitialize();
		hr = CoInitializeEx( NULL, COINIT_MULTITHREADED );		
		if ( FAILED( hr ) )	{
			wprintf( L"CoInitialize failed. Error 0x%0x\n", hr );
			goto comError;
		}
	}

	exit_Code = ShellExecuteEx(&lpExecInfo);
         
	//wait until a shell command is finished
	if(lpExecInfo.hProcess !=NULL) {
		::WaitForSingleObject(lpExecInfo.hProcess, INFINITE);
		::CloseHandle(lpExecInfo.hProcess);
	}

	comError:
	CoUninitialize();	

GeneralRe: Todays Question, ShellExecute using - start /w pkgmgr.exe /iu: Pin
TheGreatAndPowerfulOz28-Sep-11 11:02
TheGreatAndPowerfulOz28-Sep-11 11:02 
Questioncall to 'another program from C code Pin
salv0328-Sep-11 4:46
salv0328-Sep-11 4:46 
AnswerRe: call to 'another program from C code Pin
Madhu Nair28-Sep-11 5:36
Madhu Nair28-Sep-11 5:36 
GeneralRe: call to 'another program from C code Pin
salv0328-Sep-11 5:52
salv0328-Sep-11 5:52 
GeneralRe: call to 'another program from C code Pin
David Crow28-Sep-11 7:06
David Crow28-Sep-11 7:06 
GeneralRe: call to 'another program from C code Pin
Albert Holguin29-Sep-11 3:45
professionalAlbert Holguin29-Sep-11 3:45 
Questionindex of HTREEITEM item? Pin
zon_cpp28-Sep-11 0:56
zon_cpp28-Sep-11 0:56 
QuestionRe: index of HTREEITEM item? Pin
Code-o-mat28-Sep-11 1:42
Code-o-mat28-Sep-11 1:42 
AnswerRe: index of HTREEITEM item? Pin
Madhu Nair28-Sep-11 1:47
Madhu Nair28-Sep-11 1:47 
GeneralRe: index of HTREEITEM item? Pin
zon_cpp28-Sep-11 2:06
zon_cpp28-Sep-11 2:06 
GeneralRe: index of HTREEITEM item? Pin
Stefan_Lang28-Sep-11 4:52
Stefan_Lang28-Sep-11 4:52 
AnswerRe: index of HTREEITEM item? Pin
Maximilien28-Sep-11 2:52
Maximilien28-Sep-11 2:52 
GeneralRe: index of HTREEITEM item? Pin
Stefan_Lang28-Sep-11 4:54
Stefan_Lang28-Sep-11 4:54 
QuestionRe: index of HTREEITEM item? Pin
Code-o-mat28-Sep-11 9:57
Code-o-mat28-Sep-11 9:57 
AnswerRe: index of HTREEITEM item? Pin
Maximilien28-Sep-11 12:34
Maximilien28-Sep-11 12:34 
QuestionRe: index of HTREEITEM item? Pin
David Crow28-Sep-11 3:07
David Crow28-Sep-11 3:07 
AnswerRe: use LPARAM to get index Pin
Software_Developer28-Sep-11 3:10
Software_Developer28-Sep-11 3:10 

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.