I'm working with a customer who wants to add functionality to a legacy application. The application, whose vendor is useless, has a Windows Forms UI. What my customer wants is for certain functionality outside this application to be triggered when the user clicks on a piece of information in the application.
I've seen a simple version of this done for another customer. In this case, there's an app consisting of a form that's been set to a topmost window using SetWindowPos
. When the user clicks a button on this form, the app finds the window for the legacy app and gets information out of the window's caption. It's inelegant - there's this floating button that never goes away even if the legacy app isn't open - but it works.
I was wondering if it would be possible to do something similar to this using a borderless transparent WPF window with the Topmost
property set. The app I'm thinking of would analyze the content in the legacy app's window and define a list of hotspots. It would intercept and handle any mouse click in a hotspot, and pass all remaining mouse clicks through to the legacy app.
I'm not terrifically experienced with the Windows API, so I don't know if it's straightforward (or even possible) to implement this kind of capability. And it occurs to me that if I were authoring anti-malware tools, the application I have in mind is exactly the kind of thing I'd be trying to cripple.
If this is actually a viable project, what's the best way to approach doing it? What unexpected problems should I be looking out for?