Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SetConsoleWindowInfo failures

Status
Not open for further replies.

tootired

Programmer
Aug 28, 2002
25
GB
Hi everyone,

I'm stuck trying to get a Console application to behave consistently. Specifically, I can't get calls to SetConsoleWindowInfo to produce a window that is always the right size on the screen - every now and then it comes up much smaller than I want, with scrollbars to move around the little window.

Here is a segment of code which I'm using to have 5 attempts at the resize. SCWI() is just a call to SetConsoleWindowInfo with some debugging calls in.

for( max_tries = 1; max_tries <= 5; max_tries++ )
{
srWindowRect.Top = 0;
srWindowRect.Left = 0;
srWindowRect.Right = 79;
srWindowRect.Bottom = 23;
sprintf( SC_buffer, &quot;RWTM (#%d)&quot;, max_tries );
SCWI(Screen, TRUE, &srWindowRect);

GetConsoleScreenBufferInfo(Screen, &csbi);
if( csbi.srWindow.Left == 0 && csbi.srWindow.Top == 0 &&
csbi.srWindow.Right == 79 && csbi.srWindow.Bottom == 23 )
{
sprintf( SC_buffer, &quot;RWTM (#%d) Succeeded&quot;, max_tries );
w32logmessage( SC_buffer );
return;
}
}

The app is developed in C++ under MS Visual Studio version 6.

Thanks for any helpful thoughts...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top