Jump to content
  • Advertisement
Sign in to follow this  
ripspinner

Program No Console Window?

This topic is 4277 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do I create a program in C++ that runs in the background without a console window. Do I need to resort to windows programming and not show the window?

Share this post


Link to post
Share on other sites
Advertisement
I believe I saw a command for it at one point, but sadly I dont know what it is.

Do you want it listed in the task bar? or that little spot next to the clock ? or only in the task manager?

Sorry I can't help you further, but if you answer those questions maybe someone will be able to help you more.

Share this post


Link to post
Share on other sites
Quote:

Do I need to resort to windows programming and not show the window?


Yes, you'll need to create a "Win32" project instead of a console project (this will set up the appropriate project options to omit the automatic linking with the CRT boot code that sets up the console window, and a couple other things; you can change this in an existing project if you know what to look for).

Then just don't create a window.

Share this post


Link to post
Share on other sites
I would like to just have it run in the taskmanager for now.

Also i was trying to use getch to read ctrl` or ctrl~ and it doesn't work, how do I read these keys.

Share this post


Link to post
Share on other sites
** hack alert

Interestingly this was on windows support page to find a console window. To me its not a good idea to do but would work for existing console apps.

http://support.microsoft.com/kb/Q124103/

Then when you have the hwnd id, call ShowWindow( hwnd, SW_HIDE);

Share this post


Link to post
Share on other sites
Im not hacking I just want to create an application that runs in the background and when I press ctrl~ it runs the system cmd.exe file to bring up a console.
This was done on an appaday and I thought I'd like to try to do it in C++ sounds simple right, not really.
thnks

Share this post


Link to post
Share on other sites
Oh, then actually that code wouldn't be too too bad of a hack.

You could set up the app to hide initially, intercept windows calls in the background for key events, then show the console again.

The reason I say its a hack is that the code does a change of the console title window and then does a search for that specific window title, but given that it changes the name to something "unique", it provides a simple way to do it.

Share this post


Link to post
Share on other sites
Like I said, make a Windows app, but just don't create a window.

Now, it's going to be trickier to install the hooks you need to intercept keypresses regardless of whether or not the app has focus. You'll have to search around on the MSDN for the information.

(iminyourbrain mean "hack" in the sense that his suggestion, while it would probably work, is very inelegant and not guaranteed to work consistently, often, or at all).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!