Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to find out the source application from which data has been copied to the clipboard?

I am using the Clipboard object to play with data copied to the clipboard. Lets say I have a few applications from which I can copy data to the clipboard like Excel, Notepad, etc.

I want to know whether there is any function or any way to find out from where the data is captured in clipboard, whether it is coming from Excel or Notepad or from some unknown application.

I am using C# and .NET 2.0

like image 241
Sandhurst Avatar asked Dec 23 '22 08:12

Sandhurst


1 Answers

If you are using SetClipboardViewer api to detect when something is copied to the clipboard and processing WM_DRAWCLIPBOARD message then you can use GetClipboardOwner function to find handle to the window which initiated the operation. Using the handle you can retrieve the process id and path of the executable.

like image 176
Giorgi Avatar answered Jan 13 '23 18:01

Giorgi