Been a while since I did any program so alil rusty. I was researching on code to maximize and minimize other applications. So I found something basic and here is what I have, slightly modified from the original. It wanted me to generate some FindWindow method which I did. Now everything looks good and I tried to run it, getting a message. Not sure where to go from here. The original thread where I found it didn't mention this.
private const int SW_SHOWNORMAL = 1;
private const int SW_SHOWMINIMIZED = 2;
private const int SW_SHOWMAXIMIZED = 3;
[DllImport("user32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
static void Main(string[] args)
{
// retrieve Notepad main window handle
IntPtr hWnd = FindWindow("Notepad", "Untitled - Notepad");
if (!hWnd.Equals(IntPtr.Zero))
{
// SW_SHOWMAXIMIZED to maximize the window
// SW_SHOWMINIMIZED to minimize the window
// SW_SHOWNORMAL to make the window be normal size
ShowWindowAsync(hWnd, SW_SHOWMAXIMIZED);
}
}
private static IntPtr FindWindow(string p, string p_2)
{
throw new NotImplementedException();
}