How to prevent a 3rd party application losing the focus to my VB application.
Posted on 2003-10-28
I want to prevent a the program with the focus from losing the focus when my VB application is clicked upon, and I need to retrieve the location of the mouse click so that I can process it manually.
It is important that the application that has the focus does not receive a "lost focus" message, as this simple example should demonstrate:
If I have simple app with buttons to set the focus to Internet Explorer and send text to the address bar. One button sends "www", another sends ".experts-exchange.com".
When I click on the first button, I get "www" in the address bar. When I click on the second button, the "www" is highlighted (when IE loses focus) and is replaced with ".experts-exchange.com".
This is just a trivial example of a wider problem. I need to stop IE (or whatever the program is) from losing the focus, and I think that the way to do this is by preventing my app getting the focus.
I have battled with this for a while, but it is not an easy one. Any API/subclassing experts out there, your help appreciated!