View Full Version : Console window size
Hi,
I'm looking for a method to get a console window with
40 lines x 128 columns
I've found Console_SetScreenBufferSize(xSize, ySise) but it seems to resize
the buffer, not the window ( scroll bars appears around the window ). :(:(
It is then possible to increase size of the window with the mouse.
But what I wish is to achieve this only by program. The program I'm writing
is intended to start on conditions driven by external stimulies, an display informations that can't
enter in a 24x80 console.
Thanks for help.
ErosOlmi
06-01-2018, 02:22
Ciao,
try this one:
uses "Console"
Console_SetScreenBufferSize(40, 128)
Console_ShowWindow(%CONSOLE_SW_MAXIMIZE)
WaitKey
Ciao,
try this one:
uses "Console"
Console_SetScreenBufferSize(40, 128)
Console_ShowWindow(%CONSOLE_SW_MAXIMIZE)
WaitKey
Hi,
GREAT :D:D:D:D
Full screen of thanks,
Dany
ErosOlmi
06-01-2018, 11:50
Inside \thinBasic\SampleScripts\Console\ there are some example script that can help.
In any case just ask if you need something :)
Ciao
Eros
Hi,
After having the window sized as I want/need, I wish another control over my console windows.
The opened windows are always at the upper/left corner of my first screen (my machine have two screens).
I would wish to choose the destination screen 1 or 2, and the position of the window in that screen.
The screen and position should ideally set by variables in the script.
IE: debug windows in left screen, alert windows centerd in right screen.
Let me know if it' possible
Dany
hello dco045
I think it should be possible, here's someone that did something similar to what your after but it's in FreeBasic but maybe it will give you ideas on how to do it in ThinBasic https://www.freebasic.net/forum/viewtopic.php?f=7&t=26211&p=241467#p241467
ErosOlmi
22-01-2018, 21:05
Honestly I use many screens at work but never thought to develop some thinBasic functionalities related to multi screens functionalities.
I have to study Windows SDK how it manage it, if it is just a width/height extension or what.
As a dirty solution you can get Console handle (the Windows ID that identify the any window) and use it to manage pixel width/height and window location using UI module.
Here an example:
uses "Console"
uses "UI"
Long ConsoleHandle
long DeskWidth
long DeskHeight
Console_SetScreenBufferSize(40, 128)
'Console_ShowWindow(%CONSOLE_SW_MAXIMIZE)
'---Get size of the virtual desktop
DESKTOP GET CLIENT TO DeskWidth, DeskHeight
Printl "Virtual desktop size is:", DeskWidth, "width", DeskHeight, "height"
ConsoleHandle = Console_GetHandle
printl "ConsoleHandle:", ConsoleHandle, hex$(ConsoleHandle)
dialog set Size ConsoleHandle, 640, 480
dialog set loc ConsoleHandle, 100, 100
WaitKey
I will let you know if I find something on multi screens handling, it can be a nice to have.
Honestly I use many screens at work but never thought to develop some thinBasic functionalities related to multi screens functionalities.
I have to study Windows SDK how it manage it, if it is just a width/height extension or what.
As a dirty solution you can get Console handle (the Windows ID that identify the any window) and use it to manage pixel width/height and window location using UI module.
Here an example:
uses "Console"
uses "UI"
Long ConsoleHandle
Console_SetScreenBufferSize(40, 128)
Console_ShowWindow(%CONSOLE_SW_MAXIMIZE)
ConsoleHandle = Console_GetHandle
printl "ConsoleHandle:", ConsoleHandle, hex$(ConsoleHandle)
dialog set Size ConsoleHandle, 640, 480
dialog set loc ConsoleHandle, 100, 100
WaitKey
I will let you know if I find something on multi screens handling, it can be a nice to have.
Hi Eros,
Console windows are running a race around my screens :D :mad: :party:
You're faster than any telecom hot line. Faster than light.....
Thanks
Dany
ErosOlmi
22-01-2018, 21:52
:D
You can get Virtual desktop size using this:
uses "Console"
uses "UI"
Long ConsoleHandle
long DeskWidth
long DeskHeight
Console_SetScreenBufferSize(40, 128)
'Console_ShowWindow(%CONSOLE_SW_MAXIMIZE)
'---Get size of the virtual desktop
DESKTOP GET CLIENT TO DeskWidth, DeskHeight
Printl "Virtual desktop size is:", DeskWidth, "width", DeskHeight, "height"
ConsoleHandle = Console_GetHandle
printl "ConsoleHandle:", ConsoleHandle, hex$(ConsoleHandle)
dialog set Size ConsoleHandle, 640, 480
dialog set loc ConsoleHandle, 100, 100
WaitKey
More info here:
Virtual screen https://msdn.microsoft.com/en-us/library/windows/desktop/dd145136(v=vs.85).aspx
https://msdn.microsoft.com/dynimg/IC444273.png
Some other info: https://msdn.microsoft.com/en-us/library/windows/desktop/dd183314(v=vs.85).aspx
I will add some functionality in next thinBasic release in order to have info on how many monitors, which is the primary one and for each have the resolution.
ErosOlmi
22-01-2018, 23:40
Dear Dany,
attached here a Bundled Executable with new functionalities working on multiple display monitor.
Can you please run it and give feedback on what you see.
Actually I do not have multiple monitor at home so my screen data is like the attached one.
If you have more than one monitor you should get the number of monitor and for each of them resolution and working area relative to primary monitor
Thanks a lot
Eros
Dear Dany,
attached here a Bundled Executable with new functionalities working on multiple display monitor.
Can you please run it and give feedback on what you see.
Actually I do not have multiple monitor at home so my screen data is like the attached one.
If you have more than one monitor you should get the number of monitor and for each of them resolution and working area relative to primary monitor
Thanks a lot
Eros
Great,
attached : the window copy.
Regards,
Dany
ErosOlmi
23-01-2018, 00:36
Great, thanks a lot.
Seems working fine.
You have 2 monitors faced horizontally, left is primary.
I will test more facing monitor with different resolutions.
I will add those new features for the next thinBasic beta release.
Code will be something like the following, maybe I will go deeper with Resolution and WorkArea
long nMonitor
printl "-----------------------------------------------"
printl "Monitor count :", app.monitor.Count
printl "-----------------------------------------------"
for nMonitor = 1 to app.monitor.Count
printl "Monitor", nMonitor, "info" in %CCOLOR_FLIGHTCYAN
printl " is primary:", app.monitor(nMonitor).IsPrimary
printl " Resolution:", app.monitor(nMonitor).Resolution
printl " WorkArea :", app.monitor(nMonitor).WorkArea
Next
Hi Eros,
I added a USB to VGA converter and another screen.
I tried to modify logical position of the added screen, and also resolution.
I think your program correctly reports configurations, as you will see in screenshots.
Just a detail : in config_1 , The display is reversed as seen in a mirror ! Just for fun :confused:
Best regards.
Dany
ErosOlmi
23-01-2018, 22:58
Wow great tests, thanks!
I think there is an error in calculating desktop virtual size.
Actually I'm reporting only primary monitor resolution instead of the sum of the monitors.
I will have a look.