This blog has moved to http://ThePowerShellGuy.com
ls, I started on my MSH ClipBoard object.
after my POC, it was a bit more work as I did expect at first.
because I needed threads,Hence I needed events to put the data back.
also I needed a ParameterizedThreadStart, to get input to the thread.
basicly I made 2 classes, one I call from MSH (ClipBoard), and 1 class STA that gets called by the Clipboard class on a STA thread.
if it has to return something, it will Raise a Ready Event that ClipBoard will Handle.
the function in the Clipboard-class will loop until the STA tread is ready, and then returns the result to MSH.
As for every function in the original Class, I had to make 2 functions in my wrapper, and I needed some EventHandlers there is a lot of boilerCode.
so I did not (yet ?) do All Methods of te original object.
but the rest is more of the same (.. and boring)
I did all the Contains except data, and the get / set as Text.
you can find the wrapper (MowClipboard.dll) here
After you load it you can do things like this :
MSH G:\Monad> [System.Reflection.Assembly]::LoadFile("g:\monad\MowClipBoard.dll"
GAC Version Location
--- ------- --------
False v2.0.50215 g:\monad\MowClipBoard.dll
MSH G:\Monad> $clip = new-object mow.clipboard
MSH G:\Monad> $clip.SetText("Hello ClipBoard")
MSH G:\Monad> $clip.ContainsText()
MSH G:\Monad> $clip.GetText()
MSH G:\Monad> $clip gm
Name MemberType Definition
---- ---------- ----------
Clear Method System.Void Clear()
ContainsAudio Method System.Boolean ContainsAudio()
ContainsFileDropList Method System.Boolean ContainsFileDropList()
ContainsImage Method System.Boolean ContainsImage()
ContainsText Method System.Boolean ContainsText()
Equals Method System.Boolean Equals(Object obj)
GetHashCode Method System.Int32 GetHashCode()
GetText Method System.String GetText()
GetType Method System.Type GetType()
SetText Method System.Void SetText(String Text)
ToString Method System.String ToString()