Re: ReadConsoleOutput changes the size of my SMALL_RECT... help!
From: Roger Willcocks (rkww_at_rops.org)
Date: 03/27/05
- Next message: Sm704: "Am I wasting my time learning Pascal?"
- Previous message: Roger Willcocks: "Re: stl iterator question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 27 Mar 2005 11:32:07 +0100
"Eric A. Johnson" <nothere@dontlookforme.com> wrote in message
news:jfi1e.15751$C47.3887@newssvr14.news.prodigy.com...
> Hello All,
>
> I'm having a problem with the below code. I am trying to copy an area
> of screen space into an X by Y array of type CHAR_INFO before I overwrite
it
> with my "window". If I comment out the line that uses ReadConsoleOutput
to
> copy the screen area, the SMALL_RECT (WindowRectangle) is unchanged, and
the
> window displays just fine. However, if I uncomment it, it changes
> WindowRectangle's dimensions to a much smaller size, resulting in a
smaller
> (or even nonexistant) window. How do I fix this? I'm at my wit's end.
> Below is the relevant code. If somebody needs more or all of the source,
I
> will gladly post it -- just let me know. Thanks!
>
> Sincerely,
>
> Eric
>
> /* Create a new window */
> void ConsoleLib::WindowCreate(COORD Start, COORD Size, bool Border)
> {
> int column, row;
> SMALL_RECT WindowRectangle;
> COORD Position;
> /*... more unrelated code here ...*/
>
> // Make an array (buffer) to hold the screen info I will overwrite
> CharInfo = new CHAR_INFO[Size.X, Size.Y];
>
> // Save the screen information that will be overwritten into CharInfo
> /*** NOTE: The line below is strangely altering WindowRectangle ***/
> // ReadConsoleOutput(m_Screen, CharInfo, Size, Start, &WindowRectangle);
>
> }
>
> Notes: m_Screen is a handle to the console; CharInfo has been previously
> declared as a pointer to CHAR_INFO; Border simply declares whether the
> window has a visible border or not. I make all the important changes to
> Size before declaring the new CharInfo array. Start is not changed at
all.
> It's still starting at the same position; it simply ends both the length
and
> width before it should. I am using the WindowRectangle borders to control
> the display of the Window, to encertain that the information it saves is
the
> same as what is written over. I want to be able to replace the original
> information when the window is destroyed.
>
>
This is not really a comp.programming question. I was going to suggest
comp.os.ms-windows.programmer.win32, but I notice you've already asked the
same question there...
In any case read the manual more closely, particularly with respect to the
fourth parameter, which is non-obvious.
-- Roger
- Next message: Sm704: "Am I wasting my time learning Pascal?"
- Previous message: Roger Willcocks: "Re: stl iterator question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]