When I run an application on my oldish Compaq desktop computer the CONSOLE GET FOCUS does what I want and gives me a display which fills the physical screen. When I run the same application on a slightly newer Acer 5745 laptop the display fills only the top left quarter.of the physical screen. I can make it fill the whole screen by using the Windows maximise button, but how can I make sure that I always get a full size display without using the Windows maximise button? I've tried a wide variety of CONSOLE instructions (eg SCREEN, VIEW, , VIRTUAL, etc) without success.
Announcement
Collapse
No announcement yet.
Maximise Size of Visible Console Screen
Collapse
X
-
Hi John,
Try using a ShowWindow CONSHNDL, 3 statement as shown in this sample code.
Regards,
Code:#COMPILE EXE #DIM ALL #BREAK ON DECLARE FUNCTION ShowWindow LIB "USER32.DLL" ALIAS "ShowWindow" (BYVAL hWnd AS DWORD, BYVAL nCmdShow AS LONG) AS LONG DECLARE FUNCTION GetLargestConsoleWindowSize LIB "KERNEL32.DLL" ALIAS "GetLargestConsoleWindowSize" (BYVAL hConsoleOutput AS DWORD) AS DWORD DECLARE FUNCTION SetConsoleFont LIB "KERNEL32.DLL" ALIAS "SetConsoleFont"(BYVAL hConsole AS DWORD, BYVAL dwIndex AS DWORD) AS LONG FUNCTION PBMAIN () AS LONG LOCAL CB??? LOCAL MaxRows, MaxCols AS WORD LOCAL ClientSize AS DWORD LOCAL ROWS&,COLUMNS&, R&, RH&, I&, J& LOCAL FG%,BG% CB??? = SetConsoleFont(GETSTDOUT, 12) 'Font Index 0 to 21 ClientSize = GetLargestConsoleWindowSize(GETSTDOUT) MaxRows = HI(WORD,ClientSize)-1 MaxCols = LO(WORD,ClientSize)-1 R&=MaxRows-1 RH&=MaxCols DESKTOP GET CLIENT TO I, J CONSOLE SET SCREEN R&, RH& ShowWindow CONSHNDL, 3 DESKTOP GET CLIENT TO I&,J& CONSOLE SET LOC (I&-CON.SIZE.X)\2,(J&-CON.SIZE.Y)\2 'Centered in the client's desktop 'Customize FG%=7 'Can change the foreground and background colors BG%=1 COLOR FG%,BG% CLS LOCATE 1,1 PRINT CON.SIZE.X,CON.SIZE.Y, I&,J& WAITKEY$ END FUNCTION
Comment
-
Hi Manuel,
The statement ShowWindow CONSHNDL, 3 does the job, but I don't understand why. I also tried ShowWindow CONSHNDL, SW_MAXIMIZE but that made the console window disappear leaving the underlying but unresponsive graphics window. I could only shut the application down by shutting down the computer.. Can you tell me how you discovered you should use 3 and not SW_MAXIMIZE ?
Comment
-
???
%SW_MAXIMIZE = 3 , did you use % in your source (not shown)((but then you'd have compile time error, not run time failure)). Using equate %SW_MAXIMIZE or literal 3 in code should make no difference.
https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx
CONSHNDL is legacy, see Help for PBCC version you use.
In PBCC 6 current syntax is - CON.HANDLE TO variable&
John, code that compiles and demonstrates error (not neccessarily your whole program) helps others help you.
Cheers,Dale
Comment
-
Originally posted by John Moorby View PostHi Manuel,
The statement ShowWindow CONSHNDL, 3 does the job, but I don't understand why. I also tried ShowWindow CONSHNDL, SW_MAXIMIZE but that made the console window disappear leaving the underlying but unresponsive graphics window. I could only shut the application down by shutting down the computer.. Can you tell me how you discovered you should use 3 and not SW_MAXIMIZE ?
If not, SW_MAXIMIZE (without the %) may have been treated as an uninitialised integer of value 0.
So that would be the equivalent of ShowWindow CONSHNDL, 0 or ShowWindow CONSHNDL %SW_HIDE.
Comment
-
Hi John,
This link provides a good explanation of the ShowWindow function, and its parameters.
https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx
IN PBCC you can also use this Built-in Equates, even though they are not documented in the PBCC Help but in the PBWIN's
%SW_HIDE, %SW_SHOWNORMAL, %SW_NORMAL, %SW_SHOWMINIMIZED, %SW_SHOWMAXIMIZED, %SW_MAXIMIZE, %SW_SHOWNOACTIVATE, %SW_SHOW, %SW_MINIMIZE, %SW_SHOWMINNOACTIVE, %SW_SHOWNA, %SW_RESTORE, %SW_SHOWDEFAULT, %SW_FORCEMINIMIZE, %SW_MAX
Please be aware that a PBCC console is an special case of a window, so only some of the parameters are functional.
I'm guessing that you are trying to alternate between a Console and one or more GRAPHIC WINDOWS. Are you aware that you can write complete and quite powerful applications within just a GRAPHIC WINDOW?
Regards,
Comment
-
Sadly I don't know what WAG means. I must get out more! You are teaching me a bit about programming, but may be I could offer you a little reactor physics. I would be happy to give each of you the whole .bas code (nearly 6000 lines, 258kB) if you are interested. Maybe you can make it run faster. Can I do that here?.
Comment
-
Originally posted by John Moorby View PostSadly I don't know what WAG means. I must get out more! You are teaching me a bit about programming, but may be I could offer you a little reactor physics. I would be happy to give each of you the whole .bas code (nearly 6000 lines, 258kB) if you are interested. Maybe you can make it run faster. Can I do that here?.
Comment
-
Hi John,
You are not alone, many members of this forums are technicians, engineers, scientists, scholars or professionals of different technical or scientific disciplines, who became programmers out of necessity to get the proper data processing tool, or the fittest to our own work or budget. Keep coding, keep asking for help.
Regards,
Comment
-
oldish CompaqMichael Mattias
Tal Systems (retired)
Port Washington WI USA
[email protected]
http://www.talsystems.com
Comment
Comment