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

  • SEARCH
  • Home
  • 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

I have a .Net console App which using a scheduled event will start, call
I have a console program written in C# that I am using to send
I have a console application project in C# 2.0 that needs to write something
I have a URI here in which a simple document.cookie query through the console
I have a console app that needs to display the state of items, but
I have a console application that will be kicked off with a scheduler. If
I have a console application that require to use some code that need administrator
I have a console application that I would like to run as 'NT AUTHORITY\NetworkService',
I have found this example on StackOverflow: var people = new List<Person> { new
I have a login.jsp page which contains a login form. Once logged in the

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.