CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2001
    Location
    India
    Posts
    1

    How to trap the ALT+TAB

    When we press ALT+TAB key a popup window appears and u can switchover to any one applications which are there. Now i want to know that how could i know that which application is currently selected from that popup, from a VB Program.


  2. #2
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: How to trap the ALT+TAB

    When your application gains or loses the user focus, when ALT+TAB occurs for example, the main window of your application is sent a WM_ACTIVATEAPP message, with the unique thread handle of the application that is gaining the focus in the lParam parameter.

    Unfortunately Visual basic does not respond to this event, so you need to subclass your main form in order to get it. I have written a dll called the EventVB dll that does this, that can be downloaded from http://www.merrioncomputing.com/Download/EventVB.dll

    Further reading
    List of windows messages - http://www.merrioncomputing.com/Even...wMessages.html
    ActiveApplicationChanged event - http://www.merrioncomputing.com/Even...onChanged.html
    Subclassing a form with EventVB - http://www.merrioncomputing.com/EventVB/Example1.html

    HTH,
    Duncan



    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

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

Featured