-1

I would like to create an program like a text module in background. With a shortcut like ALT+A I am going to simulate an double click at the current cursor position (to select a word in a third party application) and use sendkeys CTRL + C to copy the text into my clipboard.

But sendkeys does not work to copy the selected text to clipboard. Is it possible to realize an application like this?

        //Jump to cursor position
        SetCursorPos(xpos, ypos);

        //Simulate double click
        mouse_event(MOUSEEVENTF_LEFTDOWN, xpos, ypos, 0, 0);
        mouse_event(MOUSEEVENTF_LEFTUP, xpos, ypos, 0, 0);
        Thread.Sleep(50);
        mouse_event(MOUSEEVENTF_LEFTDOWN, xpos, ypos, 0, 0);
        mouse_event(MOUSEEVENTF_LEFTUP, xpos, ypos, 0, 0);

        //Copy to clipboard
        SendKeys.SendWait("^C");
        
        //Show Clipboard Text
        MessageBox.Show(Clipboard.GetText());

Thanks in advance.

lerxer
  • 41
  • 5

1 Answers1

0

topic can be closed, I found here a solution:

stackoverflow

Thanks!

lerxer
  • 41
  • 5