Thread: Problems entering Fullscreen

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    7

    Problems entering Fullscreen

    hi every one, i was trying to enter fullscreen with my console app
    but for some reason it doesnt work correctly.When i launch the
    Program it enters fullscreen for about 1 frame and then gets back
    to windowed mode,i have tryed nearly everything now SetConsoleDisplayMode,
    ALT-ENTER and even inline asm (yeah i know it wouldnt work on win32 compiler
    :P )
    im working with devcpp 4.9.9.2 and here is the code im using
    btw is there a chance to sync the screen clearing????


    Code:
    #include <windows.h> 
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    
    
    
    typedef enum {false, true}	boolean;
    
    DWORD n;
    DWORD size;
    COORD coord = {0};
    
    HANDLE h;
    WORD wOldColorAttrs;
    CONSOLE_SCREEN_BUFFER_INFO csbiInfo; 
    
    
    void renderscreen(void)
    {
    
      
      
      
      
      while(1)
      {
              printf("test");
    
              
              GetConsoleScreenBufferInfo(h, &csbiInfo);
      
              wOldColorAttrs = csbiInfo.wAttributes; 
              size = csbiInfo.dwSize.X * csbiInfo.dwSize.Y;
              SetConsoleTextAttribute ( h, FOREGROUND_RED | FOREGROUND_INTENSITY );
    
              
              FillConsoleOutputCharacter ( h, TEXT ( ' ' ), size, coord, &n );
              GetConsoleScreenBufferInfo ( h, &csbiInfo );
              FillConsoleOutputAttribute ( h, csbiInfo.wAttributes, size, coord, &n );
              SetConsoleCursorPosition ( h, coord );
      
      }
      SetConsoleTextAttribute ( h, wOldColorAttrs);
        
    
    }
    
    int main(int argc, char *argv[])
    {
      keybd_event(VK_MENU,0x38,0,0);
      keybd_event(VK_RETURN,0x1c,0,0);
      keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
      keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
      
      h =  GetStdHandle ( STD_OUTPUT_HANDLE );
      
      renderscreen();
      return 0;
    }

  2. #2
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    7
    ok i should've said that im using winxp prof. (2007 build)

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You can avoid sending the keyboard events by calling the SetConsoleDisplayMode() function instead.

    However, you also have to have a screen setting that actually corresponds to a VESA text mode, or you won't be able to enter full-screen mode.

    --
    Mats
    Last edited by matsp; 01-29-2009 at 03:17 AM.
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    7
    ok i figured out that the problem was the
    visual designs (i deactivated them and everything worked)
    is there a way to deactivate them (maybe a compiler option)
    cuz i think the users wont like to do it themself

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by YunHarla3000 View Post
    ok i figured out that the problem was the
    visual designs (i deactivated them and everything worked)
    is there a way to deactivate them (maybe a compiler option)
    cuz i think the users wont like to do it themself
    What do you mean by "visual designs"? Almost everything you can do from the console settings menu can be done via console functions.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Jan 2009
    Posts
    7
    sry (language mixup)
    i meant the visual themes (disabled them in the compatibility collum)

  8. #8
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by YunHarla3000 View Post
    sry (language mixup)
    i meant the visual themes (disabled them in the compatibility collum)
    Yes, I guess that there are other options/settings that may prevent full-screen mode.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #9
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Disabling your visual themes isn't the answer to making your console app show full screen.

    The answer is that you have to have a large enough visual buffer to handle the full screen. It doesn't matter what other settings you give it, without enough visual buffer, you won't get full screen console window in WindowsXP.

    Your console app's properties should show 80 by 25 (or whatever lines you are using) as your applications window and screen buffer size, under the tab "layout". It should have "full screen" selected. Windows XP will automatically set these settings for your app, regardless of what you set them to, so don't waste your time.

    You console windows properties (not your applications console window properties), may show either full screen or window selected, but it needs to have about 140 by 100 as the first and second entry in "layout", for it's screen buffers. The exact amount depend upon your visual themes, etc.

    I went round and around with a console app that wouldn't go full screen (and needed to), and finally stumbled upon this setting. (I kept changing the applications console settings). As soon as I changed that screen buffer setting to a larger figure, it has been good ever since. (I had to re-start the app to see the change each time I changed it, of course). Why all this run around? Because I had just changed my visual themes to show a pic in the center of the desktop, and it needed to have more visual buffers than I was giving it, now.

    Don't know if that will help you, but it was my answer for sure.

    Good luck!

  10. #10
    Registered User
    Join Date
    Jan 2009
    Posts
    7
    ok thanks for the help folks ,i finally got the fullscreen working

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. OPENGL noo--bee, fullscreen problems
    By Shadow12345 in forum Game Programming
    Replies: 2
    Last Post: 08-13-2002, 01:53 PM
  3. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  4. cursor remains in openGL fullscreen
    By Ken Fitlike in forum Game Programming
    Replies: 5
    Last Post: 03-14-2002, 08:52 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM