The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: pro3carp3 on September 21, 2005, 06:41:17 PM

Title: console buffer-resizing
Post by: pro3carp3 on September 21, 2005, 06:41:17 PM
Is there a way to disallow the user from changing the console buffer size?  I'm in the initial stages of a project where I'd like to have complete control of the console buffer.  Any suggestions?  Thanks.
Title: Re: console buffer-resizing
Post by: MichaelW on September 21, 2005, 07:23:39 PM
I don't know how you could *stop* the user from resizing the console screen buffer, but you can arrange to be notified of the resize event (polling required), and either undo the resize or (better IMO) adjust to it.

See 'Buffer-Resizing Events'  here. (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/console_input_buffer.asp)

hth


Title: Re: console buffer-resizing
Post by: pro3carp3 on September 22, 2005, 04:00:41 PM
Just as I suspected.  Related to my previous question, do you know of any way (via the regestry perhaps) to set the font and font size?
Title: Re: console buffer-resizing
Post by: MichaelW on September 23, 2005, 03:31:40 AM
According to  this (http://www.powerbasic.com/support/forums/Forum5/HTML/002428.html) "Microsoft does not provide a programmatic way to change the font after the console window has been created." But perhaps Microsoft is moving in that direction because for Windows "Longhorn" and XP you can get the current console font and font size:

MSDN: GetCurrentConsoleFont (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getcurrentconsolefont.asp)

There is some information on doing it through the registry here (on page 2):

http://www.masmforum.com/simple/index.php?topic=1745.0


Title: Re: console buffer-resizing
Post by: pro3carp3 on September 23, 2005, 01:17:08 PM
Thank you for the link to the discussion.  It has some great information that will take a while to digest.  I hadn't come across the GetCurrentConsoleFont function.  It isn't in Win32.hlp. 
Title: Re: console buffer-resizing
Post by: pro3carp3 on September 23, 2005, 04:12:51 PM
I see there are several newer console functions described at msdn.  A couple of them make reference to a system console font table, but don't provide any additional information.  What is the structure of this table and how do I access it?  Thanks.
Title: Re: console buffer-resizing
Post by: MichaelW on September 24, 2005, 03:22:08 AM
I could not find any information on the system console font table.

I had forgotten about the undocumented SetConsoleFont function that Phoenix referred to here:

http://www.masmforum.com/simple/index.php?topic=1745.msg14316#msg14316

And for kernel32.dll version 5.0.2195.7006 (Windows 2000) SetConsoleFont is included in the exported functions. Perhaps someone could check this for Windows 98.