CreateProcess + Delphi

I launch a cmd file with this code, and I don't understant why my dos window doesn't want to do in the windows 's toolbar  ?

I use Windows NT Workstation + Delphi 5

var
  AppPath: String;
  SI: TStartupInfo;
  PI: TProcessInformation;
  hProc: THandle;
  sCodeRetour: DWORD;

begin

  Application.ProcessMessages;

 
  FillChar(SI, SizeOf(SI), 0);
  SI.cb := SizeOf(SI);
  si.dwFlags:=STARTF_FORCEONFEEDBACK;       si.wShowWindow:=SW_HIDE;

if not CreateProcess(nil, PChar(AppPath)  , Nil, Nil, False,
                   REALTIME_PRIORITY_CLASS, Nil, Nil, SI, PI) then

   
    raise Exception.CreateFmt('Error',
                              [GetLastError]);

  hProc := PI.hProcess;
  CloseHandle(PI.hThread);

  if WaitForSingleObject(hProc, Infinite) <> Wait_Failed then
   
 
  CloseHandle(hProc);

 
  Application.ProcessMessages;

 
 
SChatelAsked:
Who is Participating?
 
geobulConnect With a Mentor Commented:
Hi,
si.dwFlags:=STARTF_FORCEONFEEDBACK or STARTF_USESHOWWINDOW;

if STARTF_USESHOWWINDOW is not specified, the wShowWindow is ignored.

Regards, Geo    
0
 
geobulCommented:
Hi,

Change this line:
si.wShowWindow:=SW_HIDE;
to
si.wShowWindow:=SW_MINIMIZE;

Regards, Geo
0
 
geobulCommented:
Or si.wShowWindow:=SW_SHOWMINNOACTIVE;
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
SChatelAuthor Commented:
I have still try this, but it doesn't work.
0
 
SChatelAuthor Commented:
Thanks for your help
0
 
geobulCommented:
You are welcome :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.