Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

GetClipboardOwner

Aug
2,320
111
It used to be that only Microsoft Excel would sometimes lock the clipboard,
but now it seems to be other mis-behaved applications.

This code shows me the name of the application that is currently the clipboard owner;
Code:
:: @hwndpid is from the WindowInfo plugin
::   https://charlesdye.net/dl/windowinfo.zip
::
set hwnd=%@winapi[user32.dll,GetClipboardOwner]
set pid=%@hwndpid[%hwnd]
tasklist | ffind /kvmt"%pid"

Ref: How ownership of the Windows clipboard is tracked in Win32

Joe
 
Yes, I could have used the @PIDCOMMAND function instead of TASKLIST.
Code:
echo %@pidcommand[%pid]

Joe
 
If you like TASKLIST's format, you can also:
Code:
tasklist /nf =%pid
 
Indeed.

Thankyou Charles.
 
Back
Top