Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
On Clipboard Set Event
#2
Hi,

I'm not aware of any specific functionality for this exposed by WebView2.

In your case I would be looking into trying to do this from javascript.
This link is a starting point for that: https://developer.mozilla.org/en-US/docs..._clipboard

So add the event-listener via ExecuteScript with code like:
Code:
function myOnCopyEvent() {
  console.log("Someone used Ctrl+C");
}
and then add the event listener like:
Code:
document.querySelector("body").addEventListener("copy", myOnCopyEvent);

I just tested that in MS Edge developer toolbox and it did indeed display the console log message.
FWIW, I'm using the html "body" selector here, but if you have something more specific then that should work as well.

Instead of writing to the console log you could then send a webmessage (see the webmessage demo in VB6 that comes with AntView) to trigger an event.

Based on that event triggering you can then read the clipboard from your application.
--
Wil
Reply


Messages In This Thread
On Clipboard Set Event - by maddire - 2022-07-06, 11:13:37
RE: On Clipboard Set Event - by wila - 2022-07-06, 12:59:05

Forum Jump:


Users browsing this thread: 1 Guest(s)