After some reading, I have found the way:
- Hook the double click event using something like globalmousekeyhook.codeplex.com
- (Optional) Save the current state of the clipboard
- Get The current mouse position with
GetCursorPos
fromuser32.dll
-
Get windows based on cursor position with
WindowFromPoint
from
user32.dll
[DllImport("user32.dll")] public static extern IntPtr WindowFromPoint(Point lpPoint); [DllImport("user32.dll")] public static extern bool GetCursorPos(out Point lpPoint); public static IntPtr GetWindowUnderCursor() { Point ptCursor = new Point(); if (!(PInvoke.GetCursorPos(out ptCursor))) return IntPtr.Zero; return WindowFromPoint(ptCursor); }
-
Send copy command with
SendMessage
formuser32.dll
(see
Using User32.dll SendMessage To Send Keys With ALT Modifier) - Your Code
- (Optional) Restore the clipboard content saved in step 2