Announcement

Collapse
No announcement yet.

How to start console maximized

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

  • How to start console maximized

    How do I start the console maximized? It defaults to a smaller default size and I cannot figure out how to get around this.

    thanks

  • #2
    Code:
      LOCAL sTitle AS STRING,hConsole AS LONG (or dword depending on how findwindow and showwindow are declared)
      sTitle ="AG"
      CONSOLE NAME sTitle
      CONSOLE SCREEN 26,80
      hConsole = FindWindow(BYVAL %NULL, BYVAL STRPTR(sTitle))  ' use findwindow to get hwnd
      ShowWindow hConsole, %SW_MAXIMIZE ' set to maximized
    replace stitle= with name of console window
    You will need to declare the findwindow and ShowWindow either by including win32api.inc or in a custom inc file.

    Or if you have pbcc4+ (perhaps 3 had it too)
    Code:
      local hConsole as dword
      hConsole = CONSHNDL
      ShowWindow hConsole, %SW_MAXIMIZE ' set to maximized
    You will need to declare the ShowWindow either by including win32api.inc or in a custom inc file.

    %SE_MAXIMIZE muse be defined in either case using the value from win32api.inc file.
    Last edited by Fred Buffington; 25 Nov 2007, 01:21 AM.
    Client Writeup for the CPA

    buffs.proboards2.com

    Links Page

    Comment


    • #3
      It does you no good today, but I sent this NFS in this AM in response to this:

      Code:
      #CONSOLE INITIALIZE MAXIMIZE|MINIMIZE|X,Y [, HIDDEN]
      You could send it in, too.
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        thanks

        Thank you Fred and Michael for your input. I have no documentation on showwindow. It must me a windows command and not documented in PB. I will give it a try, thanks.

        Do you have any suggestions on how to learn more about windows commands? I am a long time mainframe programmer but am just getting started in PC programming. I like PB!

        Michael, sorry but I do not know what an NFS is. I am assuming it is a request to MS. Thanks for your effort. Maybe that will have a long term affect.

        Comment


        • #5
          NFS=New Feature Suggestion, and it is made to the compiler publisher.

          Official address to send NFSs is [email protected]
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            Hello James, welcome to PBCC. I think you chose the perfect language.

            Since you are new to PC windows console, it might be that you don't have the console setup quite right.

            When you click on the small Screen looking Icon in between the '-' and 'X' Icons thats in the top right corner of your console, you should get a maximized window.

            If that Maximized window is to small for you, you probably should go to the system menu, which is in the top lefthand corner on the console's title bar, and click on Properties.

            In Properties, you can change Fonts to a larger size to make your console window grow. Properties will let you try out the different sizes, but it don't make it permant.

            If you like the size that Raster gives you, you'll have better luck at decrorating your screens using the Ascii characters. You can get larger screen sizes by choosing the Lucida fonts but some of Ascii characters don't display correctly.

            When you are through finding a size that works for you, go to Defaults and set it up permantly. The next time you run the console, it should change to the size you chose.

            If you haven't unchecked the QuickEdit box, you might want to do that so your mouse will work with the consoles. I know in win2000 and XP its needed, but I not sure about VISTA.

            If you haven't already done what I was talking about, you might check this site out:




            Good Luck......Jerry Fielden

            Comment


            • #7
              Jerry,
              The showwindow (and findwindow) are windows api functions.

              Here's a functioning example rather than a snippet

              Code:
              #COMPILE EXE
              #INCLUDE "win32api.inc"
              FUNCTION PBMAIN() AS LONG
                LOCAL sTitle AS STRING,hConsole AS LONG '(or dword depending on how  findwindow and showwindow are declared)
                sTitle ="AG"
                CONSOLE NAME sTitle
                CONSOLE SCREEN 26,80
                hConsole = FindWindow(BYVAL %NULL, BYVAL STRPTR(sTitle))  ' use findwindow to get hwnd
                ShowWindow hConsole, %SW_MAXIMIZE ' set to maximized  
                LOCATE 5,5
                PRINT "HELLO"
                WAITKEY$
              END FUNCTION
              As noted, you may need to change hConsole AS LONG to hConsole AS DWORD
              Last edited by Fred Buffington; 25 Nov 2007, 06:16 PM.
              Client Writeup for the CPA

              buffs.proboards2.com

              Links Page

              Comment


              • #8
                Windows Vista does not allow full screen console mode.
                kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

                Comment


                • #9
                  Hello Fred,

                  I knew about the FindWindow API, but they slipped in 'CONSHNDL' into PBCC in the later versions.

                  I think you can use showwindow CONSHNDL and not have to do the findwindow part of it.

                  I just thought he might have not known about going to the system menu to adjust the fonts for a larger console window size. Like Kev said, there's no full screen in VISTA, if maximize doesn't satisify him, he may have to adjust his fonts to get most of the screen filled up.

                  Comment


                  • #10
                    Well, the staff at PB replied to my NFS with....

                    > The functionalities you have requested are already built into the
                    > console compiler.
                    >
                    > #CONSOLE ON/OFF - turn the creation of a console window on and off.
                    > CONSOLE SET SCREEN - sets the size of the console window
                    > CONSOLE SET LOC - sets the location of the console window

                    I'm not surprised that I missed these, since I am not a "PB/CC guy."

                    But how come nobody else suggested these solutions for Mr. Reed?

                    Don't worry, Mr. Reed. I know it must be disappointing to not get a direct answer on only your second-ever post; but trust me, in general you will get many many quality responses, so keep on asking.

                    MCM
                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      The initial size of the console window -- any console window -- is controlled by Windows. It will depend on the system's configuration at runtime. I'd like to emphasize that this is a Windows "feature" and it is beyond the control of PB/CC, or any programming language for that matter.

                      You can change the computer's default console settings, but that is a fairly clumsy process that must be perfodiv> one way on Windows 95/98/ME systems, and another way on NT/2000 systems. It is difficult to do "programmatically", so it is usually a manual process. And if you do change the defaults, all DOS and console applications are affected.

                      All versions of Windows provide a method of configuring the console on a per-application basis, but it's not as easy or reliable as you might think.

                      The solution of maximizing the console window works on 95/98/ME systems, but on NT/2000 systems all that does is move the console to the top-left corner without resizing it. And you'll find that the 95/98/ME auto-resize system is pretty buggy, and I usually recommend that people avoid using it. Use the mouse to manually resize the console (click/drag the bottom-right corner) and you'll see what I mean.

                      The "four arrows" button is not available on NT/2000 systems either. The NT/2000 console does not have a toolbar. You can, however, press Alt-Enter to switch to the fullscreen mode on all versions of Windows, whenever a console application has the foreground.

                      The "aspect ratio" of the console -- the height-to-width ratio -- can be changed slightly by changing the fonts. Generally speaking, the "TrueType" fonts are shorter than the "Bitmap" fonts, but even if you use the optimum fonts, an 80x25 console will not fill the screen. Many PB/CC programmers add rows to the console until it fills the screen better. Check out the CONSOLE SCREEN statement. (Adding rows has another benefit... Because of a Windows 95/98/ME bug, it significantly speeds up the PRINT statement if you use a size other than 25/43/50 rows.)

                      To control the font that the console window uses you need to right-click on the console windows title bar and select properties then the font tab. Console tools has a utility that can be ran before you run your actual console application to set the console's font.

                      The only reliable method to maximize the console window in all Windows version is to use Console Tools. Console Tools gives you complete control over your program’s console window state. You can programmatically Maximize, Minimize, Un-Minimize, Restore, Hide, Show, Position, Center, and Size the console window. More information about Console Tools is available at http://www.powerbasic.com/products/contools/.

                      Console tools does this by changing the systems registry (I am guessing that it does), if you are comfortable changing the registry programatically, here are the registry keys that control the console font and size.

                      The Console key contains several subkeys that define screen size and buffer size for character-based screens in Windows NT. These subkeys appear under the following Registry path:

                      HKEY_CURRENT_USER\Console\subkeyNames

                      The Command Prompt subkey does not appear unless the current user has changed the screen colors or font for the command prompt and also checked the Save Configuration options. Use the commands on the Control menu in the command prompt to change these values.
                      Code:
                      [FONT=Courier New]Console subkey          Default value entries
                      ------------------------------------------
                      
                      Command Prompt         FontFamily=0x30
                      (All data types        FontSize=0xc0008
                      are REG_DWORD)         FullScreen=0x1
                                             PopupColors=0xf5
                                             QuickEdit=0
                                             ScreenBufferSize=0x190050
                                             ScreenColors=0x9f
                                             WindowsPosition=0x150004
                                             WindowSize=0x190050
                      Configuration          CommandRecallBufferSize=50
                      (All data types        FillAttr=0x07
                      are REG_SZ)            ScreenBufferColumns=80
                                             ScreenBufferRows=25
                                             WindowColumns=80
                                             WindowRows=25
                      Introducing            FullScreen=0x1
                      Windows NT
                      Microsoft QBASIC       FullScreen0x1
                      [/FONT]
                      Sincerely,

                      Steve Rossell
                      PowerBASIC Staff

                      Comment


                      • #12
                        Nice explanation. Might be -with good searchable 'keywords' in the title - a good candidate for the FAQ Forum?
                        Michael Mattias
                        Tal Systems (retired)
                        Port Washington WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment


                        • #13
                          Yea, Jerry, i mentioned the conshndl and even showed some code in my first post. Just took my example from an older program i had. You are correct though, if the maximize doesnt satisfy then i guess setting the font manually or making a link and adjusting the link font size is all that can be done.
                          Client Writeup for the CPA

                          buffs.proboards2.com

                          Links Page

                          Comment


                          • #14
                            Fred, I see that you did mention CONSHNDL in your first post. I must have skipped over that part or was asleep.

                            Comment


                            • #15
                              Hi Fred,
                              Your technique for maximizing the console window is immensely helpful. :applaus:

                              Thanks,
                              Walter
                              Last edited by Walter Henn; 19 Dec 2007, 04:06 AM.

                              Comment


                              • #16
                                Thanks Walter for the kind words but I cannot take credit for it. I gleaned it
                                from the forums here (and the old site).
                                Client Writeup for the CPA

                                buffs.proboards2.com

                                Links Page

                                Comment


                                • #17
                                  Originally posted by Fred Buffington View Post
                                  Thanks Walter for the kind words but I cannot take credit for it. I gleaned it
                                  from the forums here (and the old site).
                                  Nevertheless, you deserve credit for posting the technique as soon as James Reed asked about maximizing the console.

                                  I was completely flummoxed by some of the console commands which appeared not to work. I thought it had to do with a graphics problem. When I came across this thread, I was delighted to find out that it had to do with the console not being maximized.

                                  Thanks again,
                                  Walter

                                  Comment

                                  Working...
                                  X