I need to know whether there is a code for a C++ program to automatically maximize the program window since I always have to maximize the window when I run the program. I'm using Windows 7.
I am very much new to C++.
Can someone help me? Thanks.
I need to know whether there is a code for a C++ program to automatically maximize the program window since I always have to maximize the window when I run the program. I'm using Windows 7.
I am very much new to C++.
Can someone help me? Thanks.
This worked for me.
#include <windows.h>
void maximizeWindow(){
HWND hwnd = GetConsoleWindow();
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
}
Try ShowWindow(SW_MAXIMIZED). You would have to run a program you created, FindWindow(your target) and then invoke ShowWindow(SW_MAXIMIZED) on it. Note that this is achievable through AutoHotkey and no C++.
If you wanna maximize your program when it runs you can use this code in your Main Form
__fastcall TMainForm::TMainForm(TComponent* Owner) : TForm(Owner)
{
WindowState = wsMaximized;
}
Or if you want to maximize your program during codes e.g. pressing a button then you can use this code if it's in you're Main form:
ShowWindow(this->Handle, SW_SHOWMAXIMIZED);
Or this one if you're in a child one :
ShowWindow(Application->Handle, SW_SHOWMAXIMIZED);
Try this It will Work
It Will show your Output in Maximized Window.