Programmatically Maximize Window On Half Of Screen

aero, c#, winapi, windows

Solution

It's not exactly the same but fakes it well:

ShowWindow(handle, SW_MAXIMIZE);
// for a split second you might see a maximized window here
MoveWindow(handle, 0, 0, Screen.PrimaryScreen.WorkingArea.Width / 2, Screen.PrimaryScreen.WorkingArea.Height, true);

Problem

I want to maximize a random window on the left side of my screen. Can I use Windows Aero functions from my code ? This window can be maximized like that with the mouse. I just want to do that programmatically. I use `C#` and I can get the `IntPtr` of the window. If possible without faking mouse or keyboard input.

Original source