Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-01

ExecuteProcess

12 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart
to Kjow
Kjow wrote 5 lines
Hi all, I can't find it on google, so is it possible to hide the command prompt window that appears with SysUtils.ExecuteProcess('','',[]); ?

Maybe use TProcess, in options you can specify if there is a (new) console needed.

Never tested myself, so just try.

Bart

Reply by email

Henry Vermaak
to Kjow: I can't find it on google, so is it possible to hide the command prompt window that…
Kjow wrote 7 lines
Hi all, I can't find it on google, so is it possible to hide the command prompt window that appears with SysUtils.ExecuteProcess('','',[]); ? I need to run some external processes, but I would not see the console window.

Windows specific: you can do this with CreateProcess by adding CREATE_NO_WINDOW to the process creation flags. Perhaps something can be added to TProcess to make this easier.

Henry

Reply by email

Henry Vermaak
to Henry Vermaak
Henry Vermaak wrote 12 lines
On 20/01/12 10:41, Kjow wrote: > Hi all, > > I can't find it on google, so is it possible to hide the command prompt > window that appears with SysUtils.ExecuteProcess('','',[]); ? > > I need to run some external processes, but I would not see the console > window. Windows specific: you can do this with CreateProcess by adding CREATE_NO_WINDOW to the process creation flags. Perhaps something can be added to TProcess to make this easier.

There's already something in TProcess that should work. Set TProcess.StartupOptions to suoUseShowWindow and set TProcess.ShowWindow to swoHIDE (not tested).

Henry

Reply by email

Sven Barth
to Henry Vermaak
Henry Vermaak wrote 17 lines
On 20/01/12 14:38, Henry Vermaak wrote: > On 20/01/12 10:41, Kjow wrote: >> Hi all, >> >> I can't find it on google, so is it possible to hide the command prompt >> window that appears with SysUtils.ExecuteProcess('','',[]); ? >> >> I need to run some external processes, but I would not see the console >> window. > > Windows specific: you can do this with CreateProcess by adding > CREATE_NO_WINDOW to the process creation flags. Perhaps something can be > added to TProcess to make this easier. There's already something in TProcess that should work. Set TProcess.StartupOptions to suoUseShowWindow and set TProcess.ShowWindow to swoHIDE (not tested).

For TProcess the following should be sufficient before you run your process:

YourProcess.Options := YourProcess.Options + [poNoConsole];

Regards,
Sven

Reply by email

Kjow
to Henry Vermaak: There's already something in TProcess that should work. Set TProcess.StartupOptions to…

2012/1/20 Henry Vermaak

Show quoted text 6 lines
There's already something in TProcess that should work. Set TProcess.StartupOptions to suoUseShowWindow and set TProcess.ShowWindow to swoHIDE (not tested).

Thank you to all, I converted my program to TProcess and it works very well :)

...
try
 AProcess := TProcess.Create(nil);
 AProcess.CommandLine := 'command_prompt_command.exe -with -parameters';
 AProcess.Options := AProcess.Options + [poWaitOnExit, poNoConsole];
 AProcess.Execute;
 AProcess.Free;
finally
end;
...

Best Regards,
Kjow
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120120/4279090c/attachment.html>

Reply by email

Sven Barth
to Sven Barth: For TProcess the following should be sufficient before you run your process:…
Sven Barth wrote 23 lines
Am 20.01.2012 15:44, schrieb Henry Vermaak: > On 20/01/12 14:38, Henry Vermaak wrote: >> On 20/01/12 10:41, Kjow wrote: >>> Hi all, >>> >>> I can't find it on google, so is it possible to hide the command prompt >>> window that appears with SysUtils.ExecuteProcess('','',[]); ? >>> >>> I need to run some external processes, but I would not see the console >>> window. >> >> Windows specific: you can do this with CreateProcess by adding >> CREATE_NO_WINDOW to the process creation flags. Perhaps something can be >> added to TProcess to make this easier. > > There's already something in TProcess that should work. Set > TProcess.StartupOptions to suoUseShowWindow and set TProcess.ShowWindow > to swoHIDE (not tested). For TProcess the following should be sufficient before you run your process: YourProcess.Options := YourProcess.Options + [poNoConsole];

Though this option might imply that you need to use pipes as well.

Regards,
Sven

Reply by email

Henry Vermaak
to Sven Barth: For TProcess the following should be sufficient before you run your process:…
Sven Barth wrote 23 lines
Am 20.01.2012 15:44, schrieb Henry Vermaak: > On 20/01/12 14:38, Henry Vermaak wrote: >> On 20/01/12 10:41, Kjow wrote: >>> Hi all, >>> >>> I can't find it on google, so is it possible to hide the command prompt >>> window that appears with SysUtils.ExecuteProcess('','',[]); ? >>> >>> I need to run some external processes, but I would not see the console >>> window. >> >> Windows specific: you can do this with CreateProcess by adding >> CREATE_NO_WINDOW to the process creation flags. Perhaps something can be >> added to TProcess to make this easier. > > There's already something in TProcess that should work. Set > TProcess.StartupOptions to suoUseShowWindow and set TProcess.ShowWindow > to swoHIDE (not tested). For TProcess the following should be sufficient before you run your process: YourProcess.Options := YourProcess.Options + [poNoConsole];

Ah, well that's much easier. And it seems to use DETACHED_PROCESS. I didn't know that DETACHED_PROCESS hides the console window, too.

Henry

Reply by email

Joshua Lim
to Henry Vermaak

Hi,

I'm having difficulty making the combined demo work. I'm using ext321, and apache2, hope to receive some guidance. Also, can the demo work with mysql instead of firebird?

Thanks. :)

My steps:-

1. I've placed combined.cgi in the cgi-bin directory and updated the path in combined.html and users.html.
2. After that I installed Firebird server win32 and created a new database, c:\Program Files (x86)\Firebird\Firebird_2_5\db\COMBINED.FB, using "SQL Manager Lite for interbase and firebird".
3. Then i ran the sql script combined.sql
4. Next i configured combined.ini as follows:
[Database]
Path=c:\Program Files (x86)\Firebird\Firebird_2_5\db\COMBINED.FB UserName=sysdba
Password=masterkey

I go to http://localhost/users.html, i can see extjs grid load but nothing can be saved. http://localhost/combined.html displays only an empty page.

Rgds,
Joshua

Laz version: 0.9.31, SVN: 34510
FPC: 2.5.1

Reply by email

Michael Van Canneyt
to Joshua Lim
Joshua Lim wrote 5 lines
Hi, I'm having difficulty making the combined demo work. I'm using ext321, and apache2, hope to receive some guidance. Also, can the demo work with mysql instead of firebird?

I don't recommend it, but if you are stuck with mysql, then it's certainly possible. However, you'll have to rework the code, because the example relies on the presence of a generator (sequence), and MySQL does not provide that (at least not when I last checked).

If you can avoid MySQL, consider using Firebird or PostGres.

Show quoted text 19 lines
Thanks. :) My steps:- 1. I've placed combined.cgi in the cgi-bin directory and updated the path in combined.html and users.html. 2. After that I installed Firebird server win32 and created a new database, c:\Program Files (x86)\Firebird\Firebird_2_5\db\COMBINED.FB, using "SQL Manager Lite for interbase and firebird". 3. Then i ran the sql script combined.sql 4. Next i configured combined.ini as follows: [Database] Path=c:\Program Files (x86)\Firebird\Firebird_2_5\db\COMBINED.FB UserName=sysdba Password=masterkey I go to http://localhost/users.html, i can see extjs grid load but nothing can be saved. http://localhost/combined.html displays only an empty page.

What do you mean with 'nothing can be saved' ? Did you log in ? What do you see in firebug ? (I'm assuming you use Firefox or Google Chrome)

Michael.

Reply by email

Joshua Lim
to Michael Van Canneyt

Hi Michael,

Thanks. I managed to get the login page to load after moving combined.ini to cgi-bin. The login page won't show up until combined.ini exists and the db setting is correct.

However, after logging in, the user table is empty. Note, I've already added a user "test" to USERS table.

Rgds,
Joshua

Show quoted text 24 lines
> My steps:- > > 1. I've placed combined.cgi in the cgi-bin directory and updated the > path in combined.html and users.html. 2. After that I installed > Firebird server win32 and created a new database, c:\Program Files > (x86)\Firebird\Firebird_2_5\db\COMBINED.FB, using "SQL Manager Lite > for interbase and firebird". > 3. Then i ran the sql script combined.sql > 4. Next i configured combined.ini as follows: > [Database] > Path=c:\Program Files (x86)\Firebird\Firebird_2_5\db\COMBINED.FB > UserName=sysdba > Password=masterkey > > I go to http://localhost/users.html, i can see extjs grid load but > nothing can be saved. http://localhost/combined.html displays only > an empty page. What do you mean with 'nothing can be saved' ? Did you log in ? What do you see in firebug ? (I'm assuming you use Firefox or Google Chrome) Michael.

Reply by email