By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,189 Members | 904 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,189 IT Pros & Developers. It's quick & easy.

ReadConsoleOutput changes the size of my SMALL_RECT... help!

P: n/a
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.
Jul 23 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.