Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

uNiQue0815

console window HWND ?

This topic is 5840 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 can i get the hWnd of a console window ? (if my app is a console app). i''d also like to know, if/how i can create a console window from within a pure win32 app.

Share this post


Link to post
Share on other sites
Advertisement
quote:

how can i get the hWnd of a console window ? (if my app is a console app).



If you set a (unique) console title, SetConsoleTitle(..), you should be able to use:

HWND FindWindow(
LPCTSTR lpClassName, // class name
LPCTSTR lpWindowName // window name
);


quote:

i''d also like to know, if/how i can create a console window from within a pure win32 app.



All you need to do is to call AllocConsole(). If you want to be able to use cout/cin etc, you need to reopen the standard I/O handles:

freopen("CONIN$", "rb", stdin);
freopen("CONOUT$", "wb", stdout);
freopen("CONOUT$", "wb", stderr);


Regards Mats

Share this post


Link to post
Share on other sites
A console program is a pure Win32 app.


"The churches used to win their arguments against atheism, agnosticism, and other burning issues by burning the ismists, which is fine proof that there is a devil but hardly evidence that there is a God."
Ben Lindsey and Wainwright Evans

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!