Thread: Need to maximize the output window..!!!!

  1. #1
    Registered User
    Join Date
    Jan 2012
    Location
    Chennai, Tamil nadu, India
    Posts
    30

    Need to maximize the output window..!!!!

    Hello friends.., I have been programming games like Boggle and other word games using c.. For that i have to execute the program in the maximized mode..
    Usually in my compiler programs will run in small window. So, Instead of maximizing every time during running.., Is there any function or atleast a system level command like
    Code:
     system("....");
    to maximize the console screen...??

    I'm using Code Blocks IDE with gcc complier in windows 7...

    Please help me.., i've been searching answer for this for a long time.. Any help will be much grateful.. Thank you.. :-) ;-)

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    Are you using windows 7?

  3. #3
    Registered User
    Join Date
    Jan 2012
    Location
    Chennai, Tamil nadu, India
    Posts
    30
    yeah..i'm usin windows 7.. why are you asking that..???

  4. #4
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    Just found that on google
    Code:
    If you are using windows 7 then you can't view the output in full screen mode(windows7 does not support full screen mode).
    
    If your output is not a GUI , then you can increase the size of your command prompt .(which i think is worst solution :) )
    
    We cant do anything because of bloody windows7 nature :)
    how to maximise output screen in code::blocks or dev c++ | DaniWeb
    but i think that there must be a way to increase your output window.Notice that the link refers to full screen.
    My guess is that this will be achieved by playing a little with the window (try to double click on it ) and not by writing some code for it

  5. #5
    Registered User
    Join Date
    Jan 2012
    Location
    Chennai, Tamil nadu, India
    Posts
    30
    I think i didn't make my point clear..., Please see my attachments..

    Normally my compiler executes the program in a small window... as in screenshot1... But for my program, it should be in maximized form like in screenshot2.. So everytime during execution, instead of manually pressing the maximize button, is there any command to maximize the window automatically during the start of execution.?? That's my question... Am i clear now..??
    Attached Images Attached Images Need to maximize the output window..!!!!-screenshot-1-jpg Need to maximize the output window..!!!!-screenshot-2-jpg 

  6. #6
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    639
    You can do it, but the simplest way makes it so that your program can only run on Windows, which may or may not matter. If it does matter, then skip all of this.

    #include <windows.h>
    at the top of your program. Then add these two functions to your program:
    Code:
    void MaximizeOutputWindow(void)
    {
        HWND consoleWindow = GetConsoleWindow(); // This gets the value Windows uses to identify your output window 
        ShowWindow(consoleWindow, SW_MAXIMIZE); // this mimics clicking on its' maximize button
    }
    
    void RestoreOutputWindow(void)
    {
        HWND consoleWindow = GetConsoleWindow(); // Same as above
        ShowWindow(consoleWindow, SW_RESTORE); // this mimics clicking on its' maximize for a second time, which puts it back to normal
    }
    Then call the Maximize function at the start of main, and the Restore function at the end .

    If you need your program to work on Linux or Mac too, google for 'ncurses' which probably has equivalent functionality.

  7. #7
    Registered User
    Join Date
    Jan 2012
    Location
    Chennai, Tamil nadu, India
    Posts
    30
    But it shows the error: " UNDEFINED REFERENCE TO GetConsoleWindow(); "

    and when i tried in cpp, it shows, "GetConsoleWindow() was not declared in this scope"

    I'm using windows only..
    Please tell me how to remove this error...!!
    Last edited by Rehman khan; 10-08-2012 at 12:11 PM.

  8. #8
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    'GetConsoleWindow' doesn't works ??!

    Refer to posts #6 and 7. (Hint: You need to #define something.)

  9. #9
    Registered User
    Join Date
    Jan 2012
    Location
    Chennai, Tamil nadu, India
    Posts
    30

    Thanks a lot..! I did it.

    Yeah... you're right.. I saw those posts.. it was
    #define _WIN32_WINNT 0x05232.. Now it works fine..

    Thanks a lot for your help friends.. Thank you so much everyone...!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Command to Maximize Window?
    By litzkrieg in forum C Programming
    Replies: 3
    Last Post: 03-11-2011, 11:58 PM
  2. how to maximize the console window?
    By dongkhoi in forum C Programming
    Replies: 4
    Last Post: 11-09-2006, 09:06 AM
  3. maximize console window
    By detux in forum C Programming
    Replies: 1
    Last Post: 09-30-2006, 10:50 AM
  4. no maximize for the window
    By stallion in forum Windows Programming
    Replies: 3
    Last Post: 02-03-2003, 03:48 PM
  5. Stop window from being able to maximize
    By pinkcheese in forum Windows Programming
    Replies: 9
    Last Post: 07-12-2002, 03:09 PM