Solved

CreateProcess + Delphi

Posted on 2001-06-20
6
789 Views
Last Modified: 2010-04-06
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;

 
 
0
Comment
Question by:SChatel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 17

Expert Comment

by:geobul
ID: 6209553
Hi,

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

Regards, Geo
0
 
LVL 17

Expert Comment

by:geobul
ID: 6209566
Or si.wShowWindow:=SW_SHOWMINNOACTIVE;
0
 

Author Comment

by:SChatel
ID: 6209654
I have still try this, but it doesn't work.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Accepted Solution

by:
geobul earned 30 total points
ID: 6209785
Hi,
si.dwFlags:=STARTF_FORCEONFEEDBACK or STARTF_USESHOWWINDOW;

if STARTF_USESHOWWINDOW is not specified, the wShowWindow is ignored.

Regards, Geo    
0
 

Author Comment

by:SChatel
ID: 6210027
Thanks for your help
0
 
LVL 17

Expert Comment

by:geobul
ID: 6210714
You are welcome :-)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question