How to close the clipboard ressource in C#? -
below code how put text string windows clipboard. looking command close clipboard resource after not locked anymore app. know how close clipboard ressource explicitely in c#?
this code
string s = "hello world"; thread stathread3 = new thread ( delegate() { try { new setclipboardhelper(dataformats.text, s).go();} catch (exception ex) { /* exception handling */ } } ); stathread3.setapartmentstate(apartmentstate.sta); stathread3.start(); stathread3.join(); // here close clipboard // ????
this code of class setclipboardhelper
class setclipboardhelper : stahelper { readonly string _format; readonly object _data; public setclipboardhelper(string format, object data) { _format = format; _data = data; } protected override void work() { var obj = new system.windows.forms.dataobject( _format, _data ); clipboard.setdataobject(obj, true); } }
if "lock" (prevent other apps modify) clipboard calling openclipboard() method, can (and should, because prevents other applications using it) close closeclipboard().
here's sequence should stick when copying clipboard.
Comments
Post a Comment