Just starting out? Need help? Post your questions and find answers here.
xSoNiCaSx
User
Posts: 15 Joined: Mon Dec 17, 2007 5:07 pm
Post
by xSoNiCaSx » Tue Jul 29, 2008 8:25 pm
Hi all.
I have this little problem. I set my console's screen buffers size to 80x25, and I want it to stay that way. When resizing console's window it can be shrunk down (with scrollbars on the left, and the bottom).
I want to have the console unresizable. Is there any way to do this? I suppose it should be some kind of a code in the loop, or something.
Please help
Kaeru Gaman
Addict
Posts: 4826 Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany
Post
by Kaeru Gaman » Tue Jul 29, 2008 8:33 pm
there should be a window-massage via API that sets the console-window to unresizable.
(if you are not working on windows, please tell.)
but please wait for other answers, I don't know the appropriate API,
I just know it should be avaliable.
oh... and have a nice day.
xSoNiCaSx
User
Posts: 15 Joined: Mon Dec 17, 2007 5:07 pm
Post
by xSoNiCaSx » Tue Jul 29, 2008 9:03 pm
Yeah, I'm on windows.
Thanks.
Window-Message you say?... Well... I think I saw that thing somewhere... If the console window behaves like a simple window, it should be possible...
I'll search MSDN for it.
Although I don't think I will find the answer...
xSoNiCaSx
User
Posts: 15 Joined: Mon Dec 17, 2007 5:07 pm
Post
by xSoNiCaSx » Sun Aug 03, 2008 4:23 pm
Still no answer...
Can anybody help?
SFSxOI
Addict
Posts: 2970 Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....
Post
by SFSxOI » Sun Aug 03, 2008 4:38 pm
pdwyer
Addict
Posts: 2813 Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan
Post
by pdwyer » Mon Aug 04, 2008 2:10 am
These look interesting, I wonder how you can get the console handle of a PB console, Can we use the return value from OpenConsole() ? (I can't test as I'm at work at the moment)
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Sparkie
PureBatMan Forever
Posts: 2307 Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA
Post
by Sparkie » Mon Aug 04, 2008 2:50 am
Based on
http://www.purebasic.fr/english/viewtop ... 320#124320
Code: Select all
OpenConsole()
stdout = GetStdHandle_(#STD_OUTPUT_HANDLE)
With cCoord.COORD
\x = 80
\y = 25
EndWith
SetConsoleScreenBufferSize_(stdout, PeekL(cCoord))
Input()
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
Kaeru Gaman
Addict
Posts: 4826 Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany
Post
by Kaeru Gaman » Mon Aug 04, 2008 3:27 am
nice you know and use this (besides it's on-the-fly declaring),
but for better understanding for beginners,
I would replace this:
Code: Select all
With cCoord.COORD
\x = 80
\y = 25
EndWith
with that:
Code: Select all
Define cCoord.COORD
cCoord\x = 80
cCoord\y = 25
oh... and have a nice day.
netmaestro
PureBasic Bullfrog
Posts: 8451 Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada
Post
by netmaestro » Mon Aug 04, 2008 3:28 am
xSoNiCaSx wrote: When resizing console's window it can be shrunk down (with scrollbars on the left, and the bottom).
I want to have the console unresizable. Is there any way to do this?
@Sparkie: Here your code is successfully preventing the console window from being resized larger, but is allowing it to be resized smaller and adding scrollbars. I don't believe he wants this.
BERESHEIT
byo
Enthusiast
Posts: 635 Joined: Mon Apr 02, 2007 1:43 am
Location: Brazil
Post
by byo » Mon Aug 04, 2008 4:11 am
Kaeru Gaman wrote: nice you know and use this (besides it's on-the-fly declaring),
but for better understanding for beginners,
I would replace this:
Code: Select all
With cCoord.COORD
\x = 80
\y = 25
EndWith
with that:
Code: Select all
Define cCoord.COORD
cCoord\x = 80
cCoord\y = 25
It's the same thing. And it's not that better for beginnners. Everybody knows what a With : EndWith section is :roll:
Proud registered Purebasic user.
Because programming should be fun.
Sparkie
PureBatMan Forever
Posts: 2307 Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA
Post
by Sparkie » Mon Aug 04, 2008 12:47 pm
You are correct netmaestro. I'll dig a little deeper and see what I can find.
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
Sparkie
PureBatMan Forever
Posts: 2307 Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA
Post
by Sparkie » Mon Aug 04, 2008 5:36 pm
How about this one?
Code: Select all
OpenConsole()
ConsoleTitle("Console fixed size")
stdout = GetStdHandle_(#STD_OUTPUT_HANDLE)
OpenLibrary(0, "kernel32.dll")
hWin = CallFunction(0, "GetConsoleWindow")
CloseLibrary(0)
;...Remove the Size option from the menu
system_menu = GetSystemMenu_(hWin, #False)
DeleteMenu_(system_menu, 2, #MF_BYPOSITION)
DrawMenuBar_(hWin)
With windowSize.SMALL_RECT
\left = 0
\top = 0
\right = 79
\bottom = 24
EndWith
setConsoleWindowInfo_(stdout, #True, @windowSize)
With bufferSize.COORD
\x = 80
\y = 25
EndWith
SetConsoleScreenBufferSize_(stdout, PeekL(bufferSize))
Input()
CloseConsole()
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
netmaestro
PureBasic Bullfrog
Posts: 8451 Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada
Post
by netmaestro » Mon Aug 04, 2008 5:43 pm
Looks very good here!
BERESHEIT
xSoNiCaSx
User
Posts: 15 Joined: Mon Dec 17, 2007 5:07 pm
Post
by xSoNiCaSx » Mon Aug 04, 2008 8:01 pm
Yep, I wanted that the console could not be resized at all.
Big thanks, Sparkie.
Thank you all, guys! :roll:
Armoured
Enthusiast
Posts: 365 Joined: Mon Jan 26, 2004 11:39 am
Location: ITALY
Contact:
Post
by Armoured » Tue Nov 05, 2024 4:10 pm
Sparkie wrote: Mon Aug 04, 2008 5:36 pm
How about this one?
Code: Select all
OpenConsole()
ConsoleTitle("Console fixed size")
stdout = GetStdHandle_(#STD_OUTPUT_HANDLE)
OpenLibrary(0, "kernel32.dll")
hWin = CallFunction(0, "GetConsoleWindow")
CloseLibrary(0)
;...Remove the Size option from the menu
system_menu = GetSystemMenu_(hWin, #False)
DeleteMenu_(system_menu, 2, #MF_BYPOSITION)
DrawMenuBar_(hWin)
With windowSize.SMALL_RECT
\left = 0
\top = 0
\right = 79
\bottom = 24
EndWith
setConsoleWindowInfo_(stdout, #True, @windowSize)
With bufferSize.COORD
\x = 80
\y = 25
EndWith
SetConsoleScreenBufferSize_(stdout, PeekL(bufferSize))
Input()
CloseConsole()
Hi
Is it possible to do the opposite, making the same window resizable again?