This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: console IO in GUI apps


On Sun, Oct 21, 2001 at 08:10:52PM -0400, Christopher Faylor wrote:
>On Sun, Oct 21, 2001 at 02:21:49PM -0400, huntharo@msu.edu wrote:
>>Christopher Faylor <cgf@redhat.com> said:
>>>>I would also mention that there is an AttachConsole where you can use
>>>>an already existing console, you just have to know the console owner's
>>>>PID.
>>>
>>>The MSDN documentation indicates that AttachConsole is available on
>>>Windows XP only.  It's not a generic solution.
>>
>>Win32's SetStdHandle () will allow us to attach to an already open
>>console.  However, we have to get the process id of the launching
>>console before we can figure out what console handles we will pass to
>>SetStdHandle ().  I've tried looking for functions like
>>GetParentProcess (), etc.  but so far I can't find a function that will
>>return a handle, or the process id, of the launching process.
>>
>>Does anyone know of such a function?
>
>Windows doesn't have a generic way of finding the parent.  You can find
>this via functions in psapi (NT) or ToolHelp32 (9x).  pinfo.cc in cygwin
>does this, as does ps.cc, if you want to look at code.  There are also
>various code samples on the internet.

Sorry, I should have been clearer.  Neither file attempts to find the
parent pid using windows methods.  I was just pointing to an existing
application of TooHelp32 and psapi.  Both files use these calls for
other reasons.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]