Solved

CreateProcess + Delphi

Posted on 2001-06-20
6
768 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
  • 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Delphi 2010 Export to pdf 2 253
delphi custom sort exception 6 111
Sending Gmail through Delphi 3 69
add combobox item based on numbers 9 100
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now