Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Console WIndos Size

Console WIndos Size

Scheduled Pinned Locked Moved C / C++ / MFC
c++debugging
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andy202
    wrote on last edited by
    #1

    I wanted to use a Console Window to output some debug information for my MFC application, that all works fine, but would like to make the Window a bit larger without having to modify the properties of the Console WIndow by hand each time. I tried this bit of code as the Console was being created - but did not work.

    AllocConsole();
    m_hConsole = GetStdHandle( STD_OUTPUT_HANDLE );
    int handle = _open_osfhandle( (long) m_hConsole, _O_TEXT );
    m_fConsole = _fdopen( handle, "w" );
    // Try and set the Window to this size !!!!!!!!!!!!!
    dwSize.X = 120;
    dwSize.Y = 50;
    SetConsoleScreenBufferSize(m_hConsole, dwSize);

    Any sugegstions please Andy.

    L 1 Reply Last reply
    0
    • A Andy202

      I wanted to use a Console Window to output some debug information for my MFC application, that all works fine, but would like to make the Window a bit larger without having to modify the properties of the Console WIndow by hand each time. I tried this bit of code as the Console was being created - but did not work.

      AllocConsole();
      m_hConsole = GetStdHandle( STD_OUTPUT_HANDLE );
      int handle = _open_osfhandle( (long) m_hConsole, _O_TEXT );
      m_fConsole = _fdopen( handle, "w" );
      // Try and set the Window to this size !!!!!!!!!!!!!
      dwSize.X = 120;
      dwSize.Y = 50;
      SetConsoleScreenBufferSize(m_hConsole, dwSize);

      Any sugegstions please Andy.

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, on WinXP the layout tab of the console allows you to modify its buffer and window size, and to make these changes permanent for all future console windows with the same title. on Vista the option is gone, it just always does it that way. So for both: do it once manually, then keep the title constant. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      Voting for dummies? No thanks. X|


      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups