Thread: Making Program Launch Full Screen

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    5

    Making Program Launch Full Screen

    How am I able to make the following program (as a school project) launch fullscreen without pressing Alt+Enter efter it has launched

    Code:
    #include <stdio.h>
    
        
    int main()
    {
        while(1)
        printf("10010101101010011010100110010");
    
        return 0;
    
    }

  2. #2
    Registered User
    Join Date
    Feb 2006
    Posts
    155
    u have to use windows api for that.

  3. #3
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    IIIRC you need to use the windows api call to send key presses to the window (look it up I can't remember what it's called). Is there any real reason to use fullscreen? You really shouldn't unless you need to; I can't think of any reason why.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  4. #4
    C/C++ homeyg's Avatar
    Join Date
    Nov 2004
    Location
    Louisiana, USA
    Posts
    209
    What the heck kind of retarded question is this?

  5. #5
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    if i was moderator, i would kick your ass homeyg.
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  6. #6
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    it is not the most eloquent way to do it ... but here's a way:

    Code:
    	
    keybd_event(VK_MENU, 0, 0, 0);
    keybd_event(VK_RETURN, 0, 0, 0);
    keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
    keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
    This sumulates a virtual keystroke of ALT and ENTER ... include windows.h and put that hunk of code at the start .... I think I have another way of doing it, if I do, i'll post it.

  7. #7
    Registered User
    Join Date
    Feb 2006
    Posts
    155
    SetConsoleDisplayMode ,,check out msdn for more information on this

  8. #8
    Registered User
    Join Date
    Mar 2006
    Posts
    5
    Quote Originally Posted by homeyg
    What the heck kind of retarded question is this?
    One about how to make a program run fullscreen

    Quote Originally Posted by twomers
    it is not the most eloquent way to do it ... but here's a way:

    Code:


    keybd_event(VK_MENU, 0, 0, 0);
    keybd_event(VK_RETURN, 0, 0, 0);
    keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
    keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);



    This sumulates a virtual keystroke of ALT and ENTER ... include windows.h and put that hunk of code at the start .... I think I have another way of doing it, if I do, i'll post it.
    Where did i put this if it was after main() then it will still run in a small window and not make it full screen.

    Just in case you are wondering this is what it looks like now
    Code:
    #include <stdio.h>
    #include <windows.h>
    
    
      
    int main()
          {
          keybd_event(VK_MENU, 0, 0, 0);
          keybd_event(VK_RETURN, 0, 0, 0);
          keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
          keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0); 
          while(1)
          printf("10010101101010011010100110010");
          return 0;
    
    }

  9. #9
    Registered User
    Join Date
    Feb 2006
    Posts
    155
    Code:
    #include <stdio.h>
    #include <windows.h>
    
    void launchfullscreen(void)
    {
        COORD                       coordScreen = { 0, 0 };
       
       
      HANDLE                      hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
        
        SetConsoleDisplayMode(hConsole,1,&coordScreen);
     
    }
    
      
    int main()
          {
          launchfullscreen();
          printf("10010101101010011010100110010");
          return 0;
    
    }
    this should work

  10. #10
    Registered User
    Join Date
    Mar 2006
    Posts
    5
    just a few problems with this (within the coding)
    binary.cpp: In function `int main()':
    binary.cpp:9: error: `launchfullscreen' undeclared (first use this function)
    binary.cpp:9: error: (Each undeclared identifier is reported only once for each function it appears in.)
    binary.cpp: In function `void launchfullscreen()':
    binary.cpp:16: error: `void launchfullscreen()' used prior to declaration
    binary.cpp:22: error: `SetConsoleDisplayMode' undeclared (first use this function)

    That is a little beyond my ability to trouble sshoot that at the moment

    that reminds me to read more tutorial

  11. #11
    Registered User
    Join Date
    Feb 2006
    Posts
    155
    try including wincon.h;

    works just fine on my machine,,compiler dmc, and dont type the code,use copy and paste.

  12. #12
    Registered User
    Join Date
    Mar 2006
    Posts
    5
    DEV C++ Still doesn't like line 12 although this has fixed the rest of its moaning

    LOG For the record:

    C:\Documents and Settings\msmith\Desktop\binary.cpp: In function `void launchfullscreen()':
    C:\Documents and Settings\msmith\Desktop\binary.cpp:12: error: `SetConsoleDisplayMode' undeclared (first use this function)
    C:\Documents and Settings\msmith\Desktop\binary.cpp:12: error: (Each undeclared identifier is reported only once for each function it appears in.)

  13. #13
    Registered User
    Join Date
    Feb 2006
    Posts
    155
    yeah u have to update your wincon.h file,,,

    so go to include folder search for wincon.h


    scroll through it,,make sure u have the right file,where u see some functions,

    add this :

    WINBASEAPI
    BOOL
    WINAPI
    SetConsoleDisplayMode(
    HANDLE hConsoleOutput,
    DWORD dwFlags,
    PCOORD lpNewScreenBufferDimensions
    );

  14. #14
    Registered User
    Join Date
    Feb 2006
    Posts
    155
    if that wincon points to another wincon inside another folder ,go there.

  15. #15
    Registered User
    Join Date
    Mar 2006
    Posts
    17
    is there a way to make the screen a higher resolution using SetConsoleDisplayMode()?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help on making program run more efficiently
    By peeweearies in forum C Programming
    Replies: 2
    Last Post: 03-23-2009, 02:01 AM
  2. Using keybd_event for a Full Screen Application?
    By n759c in forum Windows Programming
    Replies: 0
    Last Post: 03-07-2006, 10:04 PM
  3. Full Screen
    By west in forum C++ Programming
    Replies: 4
    Last Post: 03-08-2005, 08:40 AM
  4. Dialog box with full screen app.
    By curlious in forum Windows Programming
    Replies: 2
    Last Post: 10-27-2003, 10:37 AM
  5. Full Screen
    By JamMan in forum C++ Programming
    Replies: 3
    Last Post: 11-21-2001, 03:10 PM