Thread: Adding a console window to a Win32 app

  1. #1
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607

    Adding a console window to a Win32 app

    http://www.halcyon.com/~ast/dload/guicon.htm

    This is very nice. Now you have a way to log information right from a DirectX app without adding any extra classes. It allows you to write to the console window using printf(), fprintf(), and std::cout. It also redirects stdin and stderr.

    The best part is you don't have to call any Win32 console related functions.

  2. #2
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    COOL! o.o! I need this, couldn't figure the other stuff out xD Lemme give this a try
    And ultra thanks!
    Currently research OpenGL

  3. #3
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    YAY! It worked! Dude, you just put alot of frustration off me! Thanks!
    Currently research OpenGL

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Very sweet! Thanks!

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Cool, but in Visual Studio 2008 I just make my projects console projects, and add _WIN32 to my #defines. Then use GetModuleHandle(0) to get the hInstance. now I have a console application that can use win32 windows.

    Maybe I am missing something, but this works greats with my games.

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    If you use the console subsystem (linker option) then you always start with a console. A non-console subsystem can create a console only if it needs/wants to.

    Whatever meets your requirements.

    gg

  7. #7
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Yeah, console + GUI is awesome. You see commercial games have it enabled for debug during beta sometimes (Age of Conan).
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  8. #8
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    I compile debug with _CONSOLE;_WIN32. Then build release with only _WIN32. So that code seems somewhat pointless to me, but to each their own.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SDL Window opening with Console Window
    By carrotcake1029 in forum Windows Programming
    Replies: 2
    Last Post: 12-23-2008, 03:32 PM
  2. confused about adding controls to main window
    By terracota in forum Windows Programming
    Replies: 4
    Last Post: 11-24-2004, 12:35 PM
  3. Adding colour & bmps to a Win 32 Window??
    By carey_sizer in forum Windows Programming
    Replies: 4
    Last Post: 09-04-2004, 05:55 PM
  4. Problems with standard WIN32 Code
    By BruceLeroy in forum Windows Programming
    Replies: 6
    Last Post: 08-24-2004, 09:20 AM
  5. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM