#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    2
    Rep Power
    0

    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).

    regards
    cocoabean
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    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
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    2
    Rep Power
    0
    Thank you for your reply,

    Actually I did that before posting in the forum, but the window handle was wrong ;)

    regards
    cocoabean

IMN logo majestic logo threadwatch logo seochat tools logo