Using the CONSOLE for output from a Dialog-based MFC App 
Author Message
 Using the CONSOLE for output from a Dialog-based MFC App

I have a GUI app that I would like to have send its log to the Console of
the DOS Window that initiated it. Can this be done? Is there any information
on this anyplace?

Thanks,
David Rogers



Mon, 18 Jun 2001 03:00:00 GMT  
 Using the CONSOLE for output from a Dialog-based MFC App
David,

Yes, this is perfectly possible. Look at Knowledge Base Article Q105305
"Calling CRT Output Routines from a GUI Application" for details.

--
Tomas Restrepo

http://members.xoom.com/trestrep/



Quote:
> I have a GUI app that I would like to have send its log to the Console of
> the DOS Window that initiated it. Can this be done? Is there any
information
> on this anyplace?

> Thanks,
> David Rogers



Mon, 18 Jun 2001 03:00:00 GMT  
 Using the CONSOLE for output from a Dialog-based MFC App
Thanks, Tomas.  That article shows me how to allocate a new console and
output to it (Q139640 is also useful in this regard), however I don't see a
way to output to the DOS window that initiated me. Am I missing something
there?

David
-------------------------------------------------------

Quote:

>Yes, this is perfectly possible. Look at Knowledge Base Article Q105305
>"Calling CRT Output Routines from a GUI Application" for details.



Thu, 21 Jun 2001 03:00:00 GMT  
 Using the CONSOLE for output from a Dialog-based MFC App


Quote:
> Thanks, Tomas.  That article shows me how to allocate a new console and
> output to it (Q139640 is also useful in this regard), however I don't see
a
> way to output to the DOS window that initiated me. Am I missing something
> there?

Hi David,

The problem in getting what you want is how the process gets launched from
the command line. AFAIK, cmd.exe (nt) and command.com (9x) don't set the
standard handles correctly before spawing a GUI process, so you don't have a
way to get them from the gui process.

Though I haven't tried that, I believe you might be able to get around that
by createing a second executable, which is a console application. All it
would have to do is get the stdhandles and spawn the GUI app, inheriting
them to the GUI. SO in the  GUI, you would have the correct handles, adn you
would be able to set them up like Q105305.

It's just a thought anyway.

--
Tomas Restrepo

http://members.xoom.com/trestrep/



Fri, 22 Jun 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. MFC and DOS apps - Redirecting console output to an MFC app (Newbie)

2. MFC and DOS apps - Redirecting console output to an MFC app (Newbie)

3. output to command-line for a MFC-dialog based app

4. Getting console-based app output into a Windows view

5. Problem using delete with dialog-based MFC app

6. Problem using delete with dialog-based MFC app

7. console output with mfc apps

8. PBM: Message box not displayed after main dialog box is closed in MFC dialog-based app

9. Console Output using MFC

10. How to run a Console app from Graphic app and pick up the output

11. How to run a Console app from Graphic app and pick up the output

12. Console based program to MFC based project

 

 
Powered by phpBB® Forum Software