Announcement

Collapse
No announcement yet.

Big console

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Big console

    How do I code a console to take up the whole screen?

    I do a CON.SCREEN = 80,160 and this is the right size

    But it is not locked into the top left corner where I want it to be.

    [latest PBCC and Windows 10]

    Thanks

    [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
    Kerry Farmer

  • #2
    CON.LOC = 0, 0 (or 1, 1) puts it in the corner. Are you "accidentally" dragging out of position?
    Dale

    Comment


    • #3
      Thanks Dale

      Interesting - it only nearly works! But it is good enough
      [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
      Kerry Farmer

      Comment


      • #4
        Actually

        CON.LOC -9,1 works best

        Is that a feature of my screen/setup/whatever or is that a general answer?
        [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
        Kerry Farmer

        Comment


        • #5
          Searched MSDN, lead to this in WinCon.inc -
          Code:
          %CONSOLE_FULLSCREEN_MODE = 1
          %CONSOLE_WINDOWED_MODE   = 2
          
          declare function SetConsoleDisplayMode lib "Kernel32.dll" _
              alias "SetConsoleDisplayMode" (byval hConsoleOutput as dword, _
              byval dwFlags as dword, lpNewScreenBufferDimensions as COORD) as long
          In full screen mode it can't be moved because there is nowhere to go.

          Cheers,
          Dale

          Comment


          • #6
            You can use GetLargestConsoleWindow() to get the COORD param for SetConsoleDisplayMode()..

            But here's another option that works OK in Win10..
            Code:
            #Compile Exe        ' PBCC60
            #Dim All
            #Break On
            #CONSOLE On
            #Include "win32api.inc"
            
            Function PBMain () As Long
             Local sTemp As String
              sTemp  = Using$("Open (default) Screen # x #", Con.Screen.Col, Con.Screen.Row)
              ShowWindow Con.Handle, %SW_ShowMAXIMIZED
              sTemp += $CRLF + Using$("Max Screen # x #", Con.Screen.Col, Con.Screen.Row)
              StdOut sTemp
              ? "Esc key to exit"
              WaitKey$($Esc)
            
            End Function
            Rgds, Dave

            Comment


            • #7
              Originally posted by Dave Biggs View Post
              You can use GetLargestConsoleWindow() to get the COORD param for SetConsoleDisplayMode()..

              But here's another option that works OK in Win10..
              Is there code for PBCC Version 5 ??? Thanx-A-Lot


              Comment


              • #8
                Thanks Dale - I could not get yours to work - maybe my problem

                Thanks Dave - it works but stuffs up the line counts - still sorting it out
                [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
                Kerry Farmer

                Comment


                • #9
                  Hi Frank,
                  This is a PBCC5 version.
                  Code:
                  #Compile Exe        ' PBCC60/50
                  #Dim All
                  #Break On
                  #Console On
                  #Include "win32api.inc"
                  
                  Function PBMain () As Long
                   Local sTemp, sKey As String
                   Local Rows, Cols As Long
                    Console Get Screen To Rows, Cols
                    sTemp  = Using$("Open (default) Screen # x #", Cols, Rows)
                    ShowWindow ConsHndl, %SW_ShowMAXIMIZED
                    Console Get Screen To Rows, Cols
                    sTemp += $CRLF + Using$("Max Screen # x #", Cols, Rows)
                   StdOut sTemp + $CRLF + "Done"
                   ? "Esc key to exit"
                   Do While ConsHndl
                     sKey = inKey$
                   Loop Until sKey = $Esc
                  
                  End Function
                  Both versions are fine on Windows 10 not on Windows 7 which doesn't directly support 'FullScreen mode'
                  That means it will Maximize the rows to suit the screen size but the Window width is limited to suit the 'Default' number of columns.

                  (In Windows 7 SetConsoleDisplayMode() returns an error - "This function is not supported on this system.")
                  Rgds, Dave

                  Comment


                  • #10
                    Originally posted by Dave Biggs View Post
                    Both versions are fine on Windows 10 not on Windows 7 which doesn't directly support 'FullScreen mode'
                    That means it will Maximize the rows to suit the screen size but the Window width is limited to suit the 'Default' number of columns.

                    (In Windows 7 SetConsoleDisplayMode() returns an error - "This function is not supported on this system.")
                    Both my Home Desktop and Personal Laptop are WIN-7 powered. I've just tested your code on the laptop, and I get a max of 80 across, 68 down. Will test this on home unit later. BTW -- On the WIN-10 desktop at my workplace, I get a max of 157 across, 80 down (tiny letters).

                    With most programs I write, I do some console adjustments inside the program itself. Other adjustments are made when I compose a Windows Shortcut. For my own personal needs, this is sufficient !!

                    FUNCTION Thanx-A-Lot AS Gratitude
                    Last edited by Frank Ferrell; 29 Oct 2018, 08:01 PM.

                    Comment


                    • #11
                      On the WIN-10 desktop at my workplace, I get a max of 157 across, 80 down (tiny letters).
                      As usual you can change the font used in the console for this app by SysMenu/Properties/Font.
                      The settings are saved to the registry (stored against the app name) and reused next time that you run the app.
                      A spin off of that action is that the maximized screen is also saved and reflected in the initial screen size during subsequent App start ups.

                      Here is a version that will work a little better on Win 7.

                      Code:
                      #Compile Exe        ' PBCC60/50
                      #Dim All
                      #Break On
                      #Console On
                      #Include "win32api.inc"
                      
                      Function PBMain () As Long
                       Local sTemp, sKey As String
                       Local Rows, Cols As Long
                        Console Get Screen To Rows, Cols
                        sTemp  = Using$("Open (default) Screen # x #", Cols, Rows)
                      
                       Local WindowSize As Dword
                        WindowSize = GetLargestConsoleWindowSize (GetStdOut)     ' useful in Win 7
                        Console Set Screen (Hi(Word, WindowSize)), (Lo(Word, WindowSize))
                      
                        ShowWindow ConsHndl, %SW_ShowMaximized
                        Console Get Screen To Rows, Cols
                        sTemp += $CRLF + Using$("Max Screen # x #", Cols, Rows)
                        StdOut sTemp + $CRLF + "Done"
                        ? "Esc key to exit"
                        Do While ConsHndl
                          sKey = inKey$
                        Loop Until sKey = $Esc
                      
                      End Function
                      (Modifications to a Shortcut (font etc) override the Registry/Defauly Settings too)
                      Last edited by Dave Biggs; 29 Oct 2018, 09:42 PM. Reason: Noted effect of using shortcut to modify console settings.
                      Rgds, Dave

                      Comment


                      • #12
                        As most certainly many others have found out, creating and customizing a desktop shortcut to the programs in this thread has an impact on the results. For example, changing the shortcut's font settings (not counting other factors) will determine how many characters you can fit on a line, as well as how many lines the console window may have.

                        This has been interesting to experiment with, and I will in time try it out on programs I've written.

                        At present, my programming methods has been to construct programs that operate in a space of 80 chars across and 40 to 50 lines down. Within PBMAIN, I do the following ...

                        Code:
                            CONSOLE SET LOC 160,20 
                            CONSOLE SET SCREEN 50, 80
                            CONSOLE SET VIEW 50, 80
                            CURSOR OFF
                           ' other code, including calls to other subs and functions  
                            CONSOLE SET SCREEN 25,80
                            COLOR 7,0
                            CURSOR ON
                        After the program has been completed to satisfaction, a desktop shortcut is then created. Usual settings are these ...
                        '
                        FONTS - Lucida Console / 16-pt / Normal
                        Screen Buffer and Window Size -- 80 x (40 to 50) each
                        Location -- 160 and 20

                        Perhaps this may be unorthodox to many of you, but it is quite comfy for me, I am open to suggestions, should you wish to volunteer them.

                        Comment

                        Working...
                        X