Rahul Tyagi
October 15th, 2001, 05:34 AM
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.
Clearcode
October 15th, 2001, 06:05 AM
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/EventVB/WindowMessages.html
ActiveApplicationChanged event - http://www.merrioncomputing.com/EventVB/ApiWindow_ActiveApplicationChanged.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.