Click here to Skip to main content
16,005,120 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: I'm puzzled Pin
PJ Arends11-Mar-05 15:36
professionalPJ Arends11-Mar-05 15:36 
Questionhow to find workgroup Pin
javad_200510-Mar-05 7:25
javad_200510-Mar-05 7:25 
AnswerRe: how to find workgroup Pin
Branislav10-Mar-05 19:59
Branislav10-Mar-05 19:59 
GeneralAVI Player codec questions Pin
Member 176862410-Mar-05 7:07
Member 176862410-Mar-05 7:07 
GeneralCListCtrl highlight row Pin
DanYELL10-Mar-05 7:06
DanYELL10-Mar-05 7:06 
GeneralI got it! Pin
DanYELL10-Mar-05 7:20
DanYELL10-Mar-05 7:20 
GeneralATL Server and Access Denied Pin
Federico Milano10-Mar-05 6:59
Federico Milano10-Mar-05 6:59 
GeneralShellExecute/CreateProcess problem Pin
YaronNir10-Mar-05 6:38
YaronNir10-Mar-05 6:38 
ShellExecute/CreateProcess problem

--------------------------------------------------------------------------------

Hi,

I am using the GNU diff.exe application.

when i use command line and type thise line:

>diff.exe 1.txt 2.txt > 1.out


it works wonderfully!

now, trying to do so via code (i.e usnig Shellexecute or createprocess) doesn't work for me

here is a code snip:

szOperation = _T("diff.exe");
szParams = _T("1.txt 2.txt > 1.out"); 

HINSTANCE h = ShellExecute(NULL,
_T("open"),
szOp,
szPar,
NULL,
SW_HIDE);
int i = (int)h;

// HERE I GET AN INT THAT IS GREATER THAN 32 BUT I DON'T SEE THE FILE 1.OUT


using the createprocess also doesn't work:

STARTUPINFO siStartupInfo;
PROCESS_INFORMATION piProcessInfo;

::ZeroMemory(&siStartupInfo, sizeof(siStartupInfo));
::ZeroMemory(&piProcessInfo, sizeof(piProcessInfo));

siStartupInfo.cb = sizeof(siStartupInfo);
siStartupInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; 
siStartupInfo.wShowWindow = SW_HIDE;

bSucc = CreateProcess(szOp, 
szPar, 
0,
0,
FALSE,
CREATE_DEFAULT_ERROR_MODE,
0,
0,
&siStartupInfo,
&piProcessInfo);


while (TRUE)
{
GetExitCodeProcess(piProcessInfo.hProcess, &dwExitCode);

if (dwExitCode != STILL_ACTIVE)
break;
else
Sleep(50);
}

CloseHandle(piProcessInfo.hProcess);



HERE THE TROUBLE IS THAT THE PROCESS SUCCEEDS BUT THE dwExitCode returns value of 2 which according to diff.exe is a failure


what can I do to fix this?
thanks in advaned
Yaron


Ask not what your application can do for you,
Ask what you can do for your application
GeneralRe: ShellExecute/CreateProcess problem Pin
David Crow10-Mar-05 10:06
David Crow10-Mar-05 10:06 
GeneralRe: ShellExecute/CreateProcess problem Pin
Yaronn11-Mar-05 11:43
Yaronn11-Mar-05 11:43 
GeneralRe: ShellExecute/CreateProcess problem Pin
TheGreatAndPowerfulOz10-Mar-05 10:13
TheGreatAndPowerfulOz10-Mar-05 10:13 
GeneralRe: ShellExecute/CreateProcess problem Pin
Yaronn11-Mar-05 11:45
Yaronn11-Mar-05 11:45 
GeneralRe: ShellExecute/CreateProcess problem Pin
Michael Dunn10-Mar-05 11:55
sitebuilderMichael Dunn10-Mar-05 11:55 
GeneralRe: ShellExecute/CreateProcess problem Pin
YaronNir11-Mar-05 11:48
YaronNir11-Mar-05 11:48 
GeneralRe: ShellExecute/CreateProcess problem Pin
David Crow13-Mar-05 15:45
David Crow13-Mar-05 15:45 
GeneralOpenFileDialog....MFC Pin
C++NewBe10-Mar-05 6:08
C++NewBe10-Mar-05 6:08 
GeneralRe: OpenFileDialog....MFC Pin
bcemick10-Mar-05 6:21
bcemick10-Mar-05 6:21 
GeneralRe: OpenFileDialog....MFC Pin
Steen Krogsgaard 210-Mar-05 8:05
Steen Krogsgaard 210-Mar-05 8:05 
GeneralEquality ( operator== ) Overload Pin
Jeryth10-Mar-05 5:37
Jeryth10-Mar-05 5:37 
GeneralRe: Equality ( operator== ) Overload Pin
YaronNir10-Mar-05 6:43
YaronNir10-Mar-05 6:43 
GeneralRe: Equality ( operator== ) Overload Pin
Steen Krogsgaard 210-Mar-05 7:41
Steen Krogsgaard 210-Mar-05 7:41 
GeneralRe: Equality ( operator== ) Overload Pin
YaronNir12-Mar-05 6:33
YaronNir12-Mar-05 6:33 
GeneralRe: Equality ( operator== ) Overload Pin
Steen Krogsgaard 210-Mar-05 7:43
Steen Krogsgaard 210-Mar-05 7:43 
GeneralRe: Equality ( operator== ) Overload Pin
karle10-Mar-05 7:50
karle10-Mar-05 7:50 
GeneralRe: Equality ( operator== ) Overload Pin
Jeryth14-Mar-05 5:21
Jeryth14-Mar-05 5:21 

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.