Results 1 to 4 of 4

Thread: detect Alt Tab in my app

  1. #1

    Thread Starter
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754

    Smile

    anyone know a good technique for detecting alt tab or general loss of focus in my app as I have an agent character, and when they leave the app I want to hide the agent...

    TIA

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Use the GetAsyncKeyState API call.... If I'm right (and I usually am ) one of the gurus will come bursting into this thread and post an example-
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    Guest
    Try this: Make a Form with a Timer and set it's Interval to 1.
    Code:
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    Private Const VK_MENU = &H12
    Private Const VK_TAB = &H9
    
    Private Sub Timer1_Timer()
    
        If GetAsyncKeyState(VK_MENU) And GetAsyncKeyState(VK_TAB) Then
            Print "Alt Tab as pressed"
        End If
        
    End Sub

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134

    Thumbs up Heehee

    Looks as if i'm right once again!
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

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