Question

Here's what I would like to do in Delphi XE:
Capture a double-click in another application such that when it occurs and the text underneath the mouse is highlighted, this triggers a series of events in my application based on what the text highlighted was.

I am aware of ways to do this using a system-wide mouse hook but... Since my application and the other application will in many circumstances be hosted in a terminal service or citrix environment, I am rather reluctant to do this with a mouse hook as I'm concerned about the resource cost. (I'm picturing the server hosting hundreds of mouse hooks, one for each user... shudder). Am I being too cautious? How much is the performance and stability hit of a mouse hook? What about under the TS or citrix environment? If my gut is correct and the cost of multiple hooks would be too high, is there another way to do this?

I do not have access to the source code of the other application and the 3rd party richedit control wherein the text is found has been modified beyond all recognition and doesn't respond to the API when used as published. Help?

Was it helpful?

Solution

This isn't possible without using a system-wide mouse hook, AFAIK.

You're right to be concerned about overhead. The mouse hook (MouseProc) is called every time a window calls PeekMessage or GetMessage and there's a mouse message to be retrieved, and it will be called for every window of every application running. Even if your hook simply passes the event along to the next handler using CallNextHookEx(), it will have an impact on the system. I'd suspect that multiple sessions running under TS would be pretty nasty.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top