Making console window visible

  • Thread starter Marc Scheuner [MVP ADSI]
  • Start date
M

Marc Scheuner [MVP ADSI]

Folks,

When I have a WinForms app, and I need to output some debug messages,
I use the Debug.WriteLine calls.

I understand the concept of creating my own custom trace listeners - I
was just wondering, since the app already sends those messages to a
default trace listeners, is there any way to make that console window
visible?

Or in general - if I have a WinForms app, can I still make a console
window visible (and invisible again) that would be used for
Console.WriteLine(...) output?

Thanks!
Marc

================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
D

Deepak

Go to the Project Properties, and in General under Common Properties change
the output type to Console Application. You will then get a console window
along with your winform. Any Console.Write command will output to this
window.
 
H

Herfried K. Wagner [MVP]

Hello,

Marc Scheuner said:
Or in general - if I have a WinForms app, can I still make a
console window visible (and invisible again) that would be
used for Console.WriteLine(...) output?

This can AFAIK only be done with PInvoke on 'AllocConsole'.
 
M

Marc Scheuner [MVP ADSI]

Go to the Project Properties, and in General under Common Properties change
the output type to Console Application. You will then get a console window
along with your winform. Any Console.Write command will output to this
window.

You don't understand - I want to keep my app as a WinForms app, but
since Debug and Trace are outputting strings onto the console window,
I want to ADDITIONALLY make that console window visible.

I DO NOT want to change my app to be a console mode app.

Thanks anyway
Marc

================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
J

Joe White

You don't understand - I want to keep my app as a WinForms app, but
since Debug and Trace are outputting strings onto the console window,
I want to ADDITIONALLY make that console window visible.

I DO NOT want to change my app to be a console mode app.

You haven't explained why not. Are you under the impression that a
console app can't display windows? If so, you're mistaken. I have my
test app set to be a console app, just for the benefit of debug output
to the console window, but it's very much a Windows Forms-based app
(even uses DirectX). For the final version, I'll just make one
configuration change (set it to a Windows Forms EXE) to make the console
go away.

The only difference between a WinForms app and a console app is that the
console app has a console. Other than that, their feature set is identical.
 
M

Marc Scheuner [MVP ADSI]

<<For the final version, I'll just make one configuration change (set
it to a Windows Forms EXE) to make the console go away.
The only difference between a WinForms app and a console app is that the
console app has a console. Other than that, their feature set is identical.

well, if that's the only difference, then why can't i get the console
window to show up on demand, in my winforms app

marc

================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 

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

Top