Activate minimized window
Posted on 2011-03-09
I have an app that is used to open or restore another program. If the program isn't running, it starts it. If the program is running already, it brings the window to the front and activates it.
After getting the correct HWND handle, SetForegroundWindow(handle) works fine UNLESS the other program has been minimized, then it does nothing.
I've tried ShowWindow(handle, SW_RESTORE) and several other functions, but haven't been able to get it to cooperate. Rather than spend a ton of time trying to figure this out, I'll just ask people who know the answer.
How can I activate the minimized window, restore it, and bring it to the front?