Use SendMessage in C# to perform a CTRL-C operation on a given handle
问题 In Google Chrome you can retrieve the text of a JavaScript alert/dialog by simply having the dialog open and doing CTRL-C on the dialog. This will put the text in the dialog into the clipboard. I'm trying to use SendMessage to send CTRL-C to perform a copy on the text of a JavaScript dialog. I've already managed to do this using SendInput but unfortunately that could fail if the window doesn't have focus. I have tried using SendMessage with WM_COPY message but that didn't work for my needs.