Solved

CreateProcess + Delphi

Posted on 2001-06-20
6
800 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
Independent Software Vendors: 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

Independent Software Vendors: 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!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

729 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