Say a user highlights some text on a web page how do i copy this selected text to clipboard from my app??? I know this is possible I've seen it done!
Printable View
Say a user highlights some text on a web page how do i copy this selected text to clipboard from my app??? I know this is possible I've seen it done!
Use the SendMessage and send the WM_COPY message to the hwnd (use the WindowFromPoint API function to get the hwnd of which the mouse is over).
Code:Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long, ByVal _
wMsg As Long, ByVal wParam As Long, lParam As Any) _
As Long
Private Const WM_COPY = &H301
Private Sub Command1_Click()
SendMessage hwnd, WM_COPY, 0, 0
End Sub
Ok I'm a little simple wanna go into more detail???
But by the time they click on the button, the mouse will be over the button, making the hWnd returned that of the button, which will do nothing. You'll need to make a hotkey that does this.
Even if you use a hotkey, there's no guaranteee that the mouse will be where you want it.
Perhaps a Timer to detect a MouseUp so that the user drags and selects text, than releases the mouse, copy whatever text is selected from the hwnd that the mouse is over.