Monday 15 April 2013

windows - How can I grab exclusive access to the clipboard for testing purposes? -


I have an app, which is long story short, uses the clipboard for the part of its operation.

Sometimes, though, due to the reasons I have never taped 100% down, sometimes the clipboard is not available Sometimes RDC clients block it, sometimes it does not happen. And when you really need a type of deals, then one of the reproduces them is extremely difficult.

Can a small test program write while it is running, is not any other program allowed to access the clipboard?

I think you can call the Openclipboard and the Emptyclipboard, then just open it and close only Call the Clopboard exits from the testing application, or something like this ...

Edit with SCHNAPPLE

So this is what I must And I got the C # code to do this ...

  [DllImport ("user32.dll")] External static button Openclipboard Acdblyuend); [DllImport ("user32.dll")] External Static Hair CloseClipboard (); [DllImport ("user32.dll")] extern static IntPtr GetClipboardData (uint uFormat); Public Static Zero GetSomeDib () {OpenClipboard (System.Diagnostics.Process.GetCurrentProcess (). MainWindowHandle); IntPtr img = GetClipboard Data (8); MessageBox.Show ("Clipboard Lock"); CloseClipboard (); MessageBox.Show ("Unlock Clipboard"); }  

No comments:

Post a Comment