Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4247854
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:10:03+00:00 2026-05-21T04:10:03+00:00

I have a console which opens a window. How do I write to this

  • 0

I have a console which opens a window. How do I write to this console, using values that I am getting from controls on the form? For example such as text fields?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T04:10:04+00:00Added an answer on May 21, 2026 at 4:10 am

    To access the console under windows, you have to link your program as a console-application. In Visual C++ you can configure this in the Project Settings under Configuration Properties/Linker/System/Subsystem = Console.

    Linking your application as a concole-application does not mean you can’t open a window. It just means a) that your process will always have a console window and b) that e.g. cmd.exe will execute it synchronously (=wait for it to finish before continuing the script/showing the prompt again).

    Then you can access the console the usual way: using std::cout, printf etc.

    AFAIK there’s no (good and easy) way to get access to the console an application was started from, if the application was linked as a windowed-application. (IIRC you can however allocate a new console, but I think that’s not what you want).

    EDIT: If you want to print some messages to the console, even if output has been redirected, I suggest you use std::cerr to print to the “error output”. The “error output” defaults to the console as well, but it’s a different stream than “stdout”, and it’s normally not redirected. It can be redirected, but I think it’s a good thing to give users that option, and not work around any redirecting by printing directly to the console.

    EDIT2: When I need a “dual mode” application, i.e. one that can run with a GUI or in a command prompt, I use a console-application, and call FreeConsole() to get rid of the console window if the GUI version is selected via the commandline arguments (e.g. by not passing any arguments). That way to console will still pop up briefly if the application is started in GUI mode (e.g. by double-clicking in explorer), but it’s immediately closed so it doesn’t clutter the screen while the GUI is being used.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As the title states, I have a C# console app which uses interop to
I have this C# DLL: namespace TestCSProject { public class TestClass { public static
Let me just first point out to any IE users right now (this is
I have an application written in VB.NET ( NOT asp.net, it is a Windows
Unfortunately this is going to be a pretty open-ended question, but I am at
I have a problem with a java gui and opening a document. My problem
I have WebService: public class Service1:WebService { private readonly MNConnection _conn; private MNLpu _lpu;
I seem to be having a bit of a TEXT / UNICODE problem when
I'm very new to jQuery and trying to run a pretty simple jQueryUI dialog
Here is the full code so far: module clean #light open System open System.IO

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.