Jump to content
Sign in to follow this  
Broadcastic

ConsoleWrite from another process

Recommended Posts

Broadcastic

I have 2 processes one is Manager another is Worker.exe
Master launches worker by Run with parameters directive passing PID of Manager as well
I'm trying to reassign console from worker to the master so I will see some info from worker

 I called FreeConsole and _WinAPI_AttachConsole to Manager's PID.

$workerID=$CmdLine[1];
...
 $ManagerPID=$CmdLine[4];


 $res=_WinAPI_FreeConsole();
 $res2=_WinAPI_AttachConsole($ManagerPID);


 ConsoleWrite(" worker "&$workerID&" connected to console ");

 

I don't see any console messages from worker in my SciTE console window where Manager's console lives
Any ideas why?
 

Edited by Broadcastic

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • Simpel
      By Simpel
      Hi.
      Thanks to this post (https://www.autoitscript.com/forum/topic/189553-writing-to-cmd/?do=findComment&comment=1361142) I can now write a helpfile to the cmd when for instance passing parameter -h or -help at cmd. But then cmd is blocked by the script (I had to free it with CTRL+BREAK):
      #include <WinAPI.au3> _WinAPI_AttachConsole() $hConsole = _WinAPI_GetStdHandle(1) _WinAPI_WriteConsole($hConsole, "Print helpfile................" & @CRLF) Inside MSDN Library then I found this sentence: A process can use the FreeConsole function to detach itself from its console.
      But I don't find something like _WinAPI_FreeConsole(). How can I do it in another way?
      Regards, Conrad
×