How to maximize a window

There is only one thing I need here. When the paint program is opened I need it to automatically open it maximized.

Other than that my code works perfectly for what I'm trying to build.

It has to be maximized so when a friend opens it after I send it to him, it auto maximizes and doesn't start drawing on his desktop.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <Windows.h>

using namespace std;

int main()
{
	system("start C:/Windows/System32/mspaint.exe");

	FreeConsole();
	Sleep(1000);

	SetCursorPos(150, 150);
	mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
	Sleep(1000);
	SetCursorPos(250, 150);
	Sleep(1000);
	mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);

	SetCursorPos(150, 200);
	mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
	Sleep(1000);
	SetCursorPos(250, 200);
	Sleep(1000);
	mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);

	SetCursorPos(150, 250);
	mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
	Sleep(1000);
	SetCursorPos(250, 250);
	Sleep(1000);
	mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);

	SetCursorPos(200, 300);
	mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
	Sleep(1000);
	SetCursorPos(300, 400);
	Sleep(1000);
	mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);

}
Anyone?
system("start /max C:/Windows/System32/mspaint.exe");

You can always find out more by typing "start /?" at the command prompt.

Hope this helps.
Thanks Duoas!
Topic archived. No new replies allowed.