Reading from a win32 console window.

This is a discussion on Reading from a win32 console window. within the C++ Programming forums, part of the General Programming Boards category; 1: Is there any way to read from the win32 console window? For instance; read whats on the screen, clear ...

  1. #1
    0x01
    Join Date
    Sep 2001
    Posts
    88

    Reading from a win32 console window.

    1: Is there any way to read from the win32 console window?
    For instance; read whats on the screen, clear the screen, then -reprint what WAS on the screen.

    2: Is there wa a to find out the spec's of the window... and maybe changeing them?


    Compiler: MSVC++ OS: Windows XP

  2. #2
    plzduntlakliekthiskthx
    Join Date
    Oct 2002
    Posts
    138
    I know there is a way to do your second questiont. In fact I have been trying to change the size of my console window for a while now. If you have the MSDN Library installed go to index and type "SetConsole" there is about ten different functions for changing console settings. I havent figured out how to use the one I need which I think is SetConsoleWindowInfo(). So, if anyone knows how to do this please tell me

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    One solution is piping. Here is one reference.

    http://support.microsoft.com/default...NoWebContent=1

    Kuphryn

  4. #4
    0x01
    Join Date
    Sep 2001
    Posts
    88
    o0obruceleeo0o, I think I figured out how to use SetConsoleWindowInfo().


    BOOL SetConsoleWindowInfo(
    HANDLE hConsoleOutput,
    BOOL bAbsolute,
    const SMALL_RECT* lpConsoleWindow
    );


    An Example:

    Code:
    #include <windows.h>
    #include <iostream.h>
    
    int main()
    {
            HANDLE     hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
            
            // Use the "SMALL_RECT" class ( just include "windows.h")
            SMALL_RECT     rect;
            rect.Top     = #;
            rect.Bottom  = #;
            rect.Left    = #;
            rect.Right   = #;
    
             // This function is located in "wincon.h"
            SetConsoleWindowInfo( hConsole, TRUE, &rect );  
            cin.get();
    
            return 0;
    }


    It works. ( change the # to real numbers, and keep changeing them to understand how it resizes the window ).

  5. #5
    plzduntlakliekthiskthx
    Join Date
    Oct 2002
    Posts
    138
    cool! its not working right because of the screen buffer I believe. Do you know how to change the console screen buffer, once again theres a function in MSDN but I dont know how to use it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C or C++
    By AcerN30 in forum Game Programming
    Replies: 41
    Last Post: 05-30-2008, 06:57 PM
  2. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  3. my wndProc is out of scope
    By Raison in forum Windows Programming
    Replies: 35
    Last Post: 06-25-2004, 07:23 AM
  4. dont want to use all params
    By stallion in forum Windows Programming
    Replies: 2
    Last Post: 02-18-2003, 07:10 AM
  5. Console VS MS DOS window
    By Shadow12345 in forum C++ Programming
    Replies: 5
    Last Post: 07-30-2002, 08:43 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21