output question

M

MikeJ

hi can i output to the console
if i have a windows app
if so....can you show me sample how

tks
MJ
 
M

Marc Gravell

If it is compiled as a windows exe then no; the "I have a console" is
part of the PE header, and you can't re-enable it after the exe has
started. You can, however, create a console exe that then chooses to
show a windows form; in this case, yes: you can write to the console.
The downside is that you can't get rid of the console until the exe
dies. Try building as a console exe; see if it does what you need...

Marc
 
B

Ben Voigt [C++ MVP]

Marc Gravell said:
If it is compiled as a windows exe then no; the "I have a console" is
part of the PE header, and you can't re-enable it after the exe has
started. You can, however, create a console exe that then chooses to
show a windows form; in this case, yes: you can write to the console.
The downside is that you can't get rid of the console until the exe
dies. Try building as a console exe; see if it does what you need...

Well, sort of. If you don't have the console flag set, you can still create
and use a console (AllocConsole API call), but you won't be using the same
console as your parent process, it will be a brand new one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top