July 20th, 2003, 01:25 PM
Windows: How to bring another application to foreground
Hi everybody !
My question is how to activate application "b" through application "a" in MS Windows (nt/w2k/xp).
The (main or application) window of application "b" shall be brought to the foreground and application "b" set as the active application done by application "a" (possibly in C code).
July 20th, 2003, 02:04 PM
Use FindWindow() to find the handle of the main Window for application B. You need to know either the window title or the class name of the window of application B to pass it to FindWindow(). This will return the handle of the window for B.
Then call SetForegroundWindow() and pass it the window handle you obtained in the previous step.
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
July 21st, 2003, 06:34 AM
Thank you for your reply,
Actually I did that before posting in the forum, but the window handle was wrong ;)