Fixed size console window

Just starting out? Need help? Post your questions and find answers here.
mouse
New User
New User
Posts: 9
Joined: Sun Mar 05, 2006 3:25 pm
Location: Isle of Wight, UK
Contact:

Fixed size console window

Post by mouse »

Hi,

Just started coding in PB and wondering how I ever did without it! :)

I'm trying to port some ancient software to windows, and the easiest way seems to be to use a graphical console (it uses a lot of PRINT, TAB, INPUT etc). I open the console like this:

Code: Select all

OpenConsole()
EnableGraphicalConsole(1)
Is there any way to make this console window fixed to a particular size so the user can't scroll etc.?

I'm currently using PB 4.00 Beta 5 on a Win XP machine.
Win XP Pro 2002 SP2 : 1Gb memory : Sempron 3400+ : GeForce 6600 GT
Out of Chocolate Error - Reboot Universe.
mouse
New User
New User
Posts: 9
Joined: Sun Mar 05, 2006 3:25 pm
Location: Isle of Wight, UK
Contact:

Post by mouse »

Here's the best solution I've got so far. This results in a titled console window at 80x25 characters that can not be resized to a larger size. Obviously this solution is for a Windows machine only

test.pb

Code: Select all

; open a graphical console
OpenConsole()
EnableGraphicalConsole(1)

; set fore and background to same to hide text output
ConsoleColor(1,1)
ClearConsole()

; sets width, height and window title
RunProgram(".\test.bat","","",#PB_Program_Wait)

; white on blue text
ConsoleColor(15,1)
ClearConsole()

Print("Hit RETURN >")
Input()

CloseConsole()
test.bat

Code: Select all

title My Software Title
mode con lines=25 cols=80
Not an ideal solution but it works! There's probably some Windows function call to do this, but I can't find one.

I can't see any way of changing the font size except for right clicking the title bar.
Win XP Pro 2002 SP2 : 1Gb memory : Sempron 3400+ : GeForce 6600 GT
Out of Chocolate Error - Reboot Universe.
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post by Bonne_den_kule »

mouse
New User
New User
Posts: 9
Joined: Sun Mar 05, 2006 3:25 pm
Location: Isle of Wight, UK
Contact:

Post by mouse »

Thanks for that,

Works perfectly. Don't know how I managed to miss it though when I searched msdn! :oops:
Win XP Pro 2002 SP2 : 1Gb memory : Sempron 3400+ : GeForce 6600 GT
Out of Chocolate Error - Reboot Universe.
Post Reply