Using Delphi's ShellExecute() with the process inheriting the original console?

Posted by Phil on Stack Overflow See other posts from Stack Overflow or by Phil
Published on 2010-04-07T21:36:31Z Indexed on 2010/04/07 21:53 UTC
Read the original article Hit count: 287

Filed under:
|

In C I've used the system() function before in a console application and if I start another process using system() it inherits the console window of the process that called it.

In Delphi system() doesn't exist so I'm using ShellExecute() to create a new process, but the new process comes up in a new console window. Is there some way that I can make it inherit the handle of the window that's calling it?

I've used

function GetConsoleWindow(): HWND; stdcall; external 'kernel32.dll';

to get the console window and passed it in the HWND part of ShellExecute(), but that didn't work.

© Stack Overflow or respective owner

Related posts about delphi

Related posts about shellexecute