[Lazarus] ExecuteProcess

Henry Vermaak henry.vermaak at gmail.com
Fri Jan 20 17:00:36 CET 2012


On 20/01/12 15:27, Sven Barth wrote:
> 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




More information about the Lazarus mailing list