kambamsu kambamsu - 1 year ago 181
C# Question

How to lock the clipboard?

I was wondering if there is anyway to lock and unlock the clipboard from C#. Basically, I'd be writing something into it and I do not want anyone else to write to it before I pick up my stuff.

How can I do this?

Answer Source

The OpenClipboard() API function, followed by EmptyClipboard() locks the clipboard until CloseClipboard is called. You should probably pass a window handle of a window in the target process. No idea if this will actually work. Visit pinvoke.net for the required declarations.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download