Results 1 to 4 of 4

Thread: Help Quick !

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Posts
    6

    Exclamation

    Is there an easy way to restore another application
    from the taskbar and set the focus to it from my application?

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    'paste this into a form, and change the Wintitle variable
    Code:
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
    Dim myHWnd As Long
    Private Sub Form_Load()
        WinTitle = "Distributed COM Configuration Properties"
        myHWnd = FindWindowEx(ByVal 0&, ByVal 0&, vbNullString, ByVal WinTitle)
        myHWnd = SetForegroundWindow(myHWnd)
    End Sub
    N.B THIS CODE WILL NOT WORK IN WIN2K!!! FOR AN EXPLANATION
    GO TO http://www.mvps.org/vb/ and look up Karls ForceForeGroundWindow routine

    blackholenun
    when you post, it would be extra cool if you could put some problem related info in the subject instead of Help Quick! It may actually get you the help quicker (just a friendly tip)

    [Edited by crispin on 12-06-2000 at 09:02 AM]
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

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

    AppActivate "App name",True

    eg; AppActivate "Microsoft Word",True

    .. !
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  4. #4
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    Hi Mark,

    Yeah I could've used AppActivate, I tend not to these days,
    I get problems with running multiple instances of the same app, and running minimised and maximised instances, when you begin to use combinations of instances and states of windows I have found the behaviour of the above to be a little unpredictable
    (just my 2 penneth)

    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

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