WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus
Main Topics
Browse All TopicsHow i can get an event or windows messages in my application, when a external process's window is activate.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Well, as the above article explains - to set a global hook (i.e. one that is notified about every message sent to any window), implement the hook proc in a DLL and call 'SetWindowsHookEx()' with the DLL' module handle and a NULL thread ID. In pseudocode, that would be
HINSTANCE hInst = LoadLibrary("myhook.dll");
HOOKPROC pProc = GetProcAddress(hInst,"MyHo
SetWindowsHookEx(WH_GETMES
As JKR told you can get all MSg for the associated window and then you can refine the message from the message queue. BUT If SetWindowHookEx last parameter is 0 , it will be hooking the message for all of the windows currently running. If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread.
So their you can put the thread id for your "single external process"
I've found a solution like this but in VB, can anyone help me to translate it to Delphi language:
http://www.experts-exchang
Well, I posted a Delphi example already - see http://www.swissdelphicent
Business Accounts
Answer for Membership
by: jkrPosted on 2009-04-07 at 09:35:14ID: 24089153
You can do that using a WH_GETMESSAGE hook that filters for that mesage. See http://msdn.microsoft.com/ en-us/libr ary/ms9975 37.aspx ("Win32 Hooks") and http://www.swissdelphicent er.ch/torr y/showcode .php?id=12 12 for a Delphi example.