简体   繁体   中英

Maximize console windows in Windows 7

i would like to know how can I maximize windows in Windows 7 OS.

I am using C language.

Do you truly need to maximize the window? You can achieve something quite similar by using the SetConsoleWindowInfo function.

As suggested by @Larry, you could use SetConsoleWindowInfo function to achieve that, Try with this code:

int main()
{
   HWND hWnd;
   SetConsoleTitle("test");
   hWnd = FindWindow(NULL, "test");
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD NewSBSize = GetLargestConsoleWindowSize(hOut);
    SMALL_RECT DisplayArea = {0, 0, 0, 0};

    SetConsoleScreenBufferSize(hOut, NewSBSize);

    DisplayArea.Right = NewSBSize.X - 1;
    DisplayArea.Bottom = NewSBSize.Y - 1;

    SetConsoleWindowInfo(hOut, TRUE, &DisplayArea);

    ShowWindow(hWnd, SW_MAXIMIZE);
    return 0;
}

Please follow this Thread

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM