How can use CreateProcess(...) in Delphi 2005 (Vcl.Net)?

In past delphi versions (no .net) I started processes with CreateProcess. Under .net I can't start a process with this routine.
I haven't errors in compilation but the process never start.

I know that there is other ways to start a process but, for me, CreateProcess is the best due to the possibilities of control.

Coul'd someone help me to know the correct way to use CreateProcess?

Thanks in advance.
RLopezLoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark BradyPrincipal Data EngineerCommented:
Use Process.Start instead of createprocess in .net applications.  this should work for you.

Regards
Elvin

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
laes_Commented:
function TForm1.WinExecAndWait32(ExName:String; Arg: String; Dir: String):Cardinal;
   var
    zAppName:array[0..512] of char;
    zCurDir:array[0..255] of char;
    WorkDir:String;
    StartupInfo:TStartupInfo;
    ProcessInfo:TProcessInformation;
    ID : Cardinal;
begin
  StrPCopy(zAppName,ExName);
  GetDir(0,WorkDir);
  StrPCopy(zCurDir,WorkDir);
  FillChar(StartupInfo,Sizeof(StartupInfo),#0);
  StartupInfo.cb := Sizeof(StartupInfo);
  StartupInfo.dwFlags := STARTF_USESHOWWINdow;
  StartupInfo.wShowWindow := 0 ;
  if not CreateProcess(nil, PChar(zAppName + ' "' +Arg+ '"'), nil , nil , false,
   CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil , PChar(Dir) ,StartupInfo,ProcessInfo)
  then Result := 0
  else begin
    WaitforSingleObject(ProcessInfo.hProcess,INFINITE);
    GetExitCodeProcess(ProcessInfo.hProcess,Result);
    Result := 1;
   end ;
end ;
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.