Results 1 to 3 of 3

Thread: How do I make a 3rd party program the active application?

  1. #1

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245

    Post

    How do I make a 3rd party program get the focus?

    I think it has something to do with "AppActivate" or something like this. An example would be appreciated, thanks.

    Daniel_Christie

    [This message has been edited by Daniel_Christie (edited 02-11-2000).]

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Try the SetForegroundWindow API, ie.
    Code:
    Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
    
    Private Sub Command1_Click()
        Call SetForegroundWindow(lHwnd)
    End Sub
    Where lHwnd is the Window Handle of the Application you want to give Focus.

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Certified AllExperts Expert

  3. #3
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670

    Post

    Or you can use

    AppActivate "title",TRUE

    eg;

    AppActivate "Microsoft Word",TRUE

    The TRUE bit means that your program has to have the focus in order to be able to activate the other program - if you make it FALSE your program can activate the other program even when it hasn't got the focus.



    ------------------
    Mark "Buzby" Beeton
    VB Developer
    [email protected]



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width