Re: Get parent's console?
From: James Brown (remove_james_dot_brown7_at_virgin_dot_net)
Date: 01/25/05
- Next message: greg: "Re: Mail application compiled in Multithread while dll in Singlethread"
- Previous message: Edward: "Re: WTSQuerySessionInformation API - WTSApplication always returne"
- In reply to: David Olsson: "Get parent's console?"
- Next in thread: qfel: "Re: Get parent's console?"
- Reply: qfel: "Re: Get parent's console?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 25 Jan 2005 18:05:53 -0000
David,
there isn't really any neat way to do this. The best approach
still seems to be using two executables - a console exe, which you
rename "prog.com", and a windows exe, called "prog.exe"...run
via the command-line, prog.com gets executed in preference to prog.exe
run via the gui....just use a short-cut to the exe.
I struggled with AttachConsole under XP, the problem seemed to be
that the C-runtime stdio handles weren't set correctly, so things like
printf / fgets just didn't work properly.
-- James --- www.catch22.net Free win32 software, sourcecode and tutorials ----- Please de-spam my email address before replying. "David Olsson" <david.olsson@vimio.com> wrote in message news:OAuzGFuAFHA.4044@TK2MSFTNGP10.phx.gbl... > Hi! > > I'm not sure if this is the correct group to post this question to but my > question doesn't fit very well in any group I've found. Anyway, here > goes... > > I would like to be able to attach a process to the console of the process > that started the process. If, for example, my process is started using the > command line (CDM.EXE), I would like to be able to access the standard in, > out and error file handles of that console. This is of course exactly what > happens if I compile and link my application as a console application. But > if I compile and link my application as a console application, I (of > course) get a console even if my application is started, for example, by > clicking a shortcut to it. It all boils down to that I want a console only > if the application has been started through a console. I've tried with the > AllocConsole() API function but it creates a new console window. > > Is there any way to accomplish want I want? I am very grateful for any > tips! > / David Olsson
- Next message: greg: "Re: Mail application compiled in Multithread while dll in Singlethread"
- Previous message: Edward: "Re: WTSQuerySessionInformation API - WTSApplication always returne"
- In reply to: David Olsson: "Get parent's console?"
- Next in thread: qfel: "Re: Get parent's console?"
- Reply: qfel: "Re: Get parent's console?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|