How to lock the clipboard?

I was wondering if there is a way to lock and unlock the clipboard with C #. Basically, I would write something in it, and I don’t want anyone else to write to him before I pick up my things.

How can i do this?

+3
source share
4 answers

The OpenClipboard () API function, followed by EmptyClipboard (), locks the clipboard until CloseClipboard is called. You should probably pass the window handle to the window in the target process. I don't know if this will really work. Visit pinvoke.net for necessary announcements.

+1
source

. , ! , () , , .

" ."
- , Windows 3.1, Microsoft Press, 1992

+3

@shambulator, , . , . ( , !).

, : Windows? , HWND? - /, ? , ?

+1
source

No, the clipboard is not working. What if the user wanted to copy something in another application, but could not, because you somehow blocked it?

If you are trying to exchange two processes, explore alternatives designed for interprocess communication, such as remote connections, named pipes, sockets, or shared memory. Remoting is probably the first place to search for applications written in C #.

0
source

Source: https://habr.com/ru/post/1748127/


All Articles