473,545 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ReadConsoleOutp ut changes the size of my SMALL_RECT... help!

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 ReadConsoleOutp ut to
copy the screen area, the SMALL_RECT (WindowRectangl e) 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::Win dowCreate(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 ***/
// ReadConsoleOutp ut(m_Screen, CharInfo, Size, Start, &WindowRectangl e);

}

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
0 1457

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5918
by: Maverick | last post by:
I'm implementing the functions of WriteConsoleOutput and ReadConsleOutput output. The "WriteConsoleOutput" can be work properly ....but the output of "ReadConsoleOutput" is wrong anyway .... can anyone tell me what's wonrg ? const int STD_OUTPUT_HANDLE = -11; const int GRID_WIDTH = 15; const int GRID_HEIGHT = 10; const int POS_X ...
6
4185
by: Lance Geeck | last post by:
I have a simple form where I am using a dataset called Client. On the data entry screen, there are name, address, city state and zip. I have the fields bound to the dataset field. (Properties screen: Data bindings then Text ) When I run the program and make a change to an existing record in the City text box, the Dataset value for this...
12
6772
by: Stefano Camaiani | last post by:
Hello, As i think, ther is no way to use ReadConsoleOutput and ReadConsoleOutPutCharacter with VB.Net or C#. Someone have some code for me? Please.... Stefano
2
3606
by: Doug Perkes | last post by:
There was a post a couple of months ago entitled "ReadConsoleOutput - ReadConsoleOutputCharacter APIs". I have some questions in relation to that post. I have an existing console application that I need to be able to connect to and read the output of the console app as well as write to it. Every time I try to call the ReadConsoleOutput...
4
4593
by: H-S | last post by:
Please help. This is a real puzzler! Originally posted on microsoft.public.dotnet.framework.windowsforms but no answer found! I have a read-only textBox which shows the results of a selection on another form. When the selection changes from the saved data, I wish to show it a different colour. As it is read-only the ForeColor property...
7
3920
by: webgyrl | last post by:
Hi, I am helping a musician friend of mine with his profile and I found a cool layout on Nas' MySpace page. I changed some things and re-did the graphics and I basically popped my Image URLS where the ones were in Nas' profile code. Something strange is happening tho. When I try to preview the layout, the entire profile is all covered up....
2
1738
by: =?Utf-8?B?VGVycnk=?= | last post by:
Hope someone has some ideas - this is driving me nuts, I am using VS2008 and have a tightly layed out form at 8 pts. The form has a font dialog and when the user changes the font size, everything works great. I go through the forms control collection (recurively) and everything resizes as it should. Ok, so the next step is to remember the...
6
2850
by: priyajohal | last post by:
#include<fstream.h> #include<process.h> #include<stdlib.h> #include<conio.h> #include<string.h> #include<dos.h> #include<ctype.h> #include<stdio.h> void setup() void help();
0
7475
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7664
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7921
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7437
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7771
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5982
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3465
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.