Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Button1_Click(object sender, EventArgs e)
- {
- var comWrapper = new COMWrapper(); // A simple wrapper for a COM object
- Task.Factory
- .StartNew(() => LoadStuff(comWrapper))
- .ContinueWith(() => {
- // Output results...
- });
- }
- int LoadStuff(COMWrapper w)
- {
- return w.LoadStuffFromCOM();
- }
- int LoadStuffFromCOM()
- {
- string buffer;
- IntPtr pointer = Marshal.StringToHGlobalUni(buffer);
- return comObject.GetValue(pointer); // Exception here...
- }
- initialization
- TTypedComObjectFactory.Create(ComServer, TSomeLogic, Class_SomeLogic,
- ciMultiInstance, tmFree);
- end.
- initialization
- TTypedComObjectFactory.Create(ComServer, TSomeLogic, Class_SomeLogic,
- ciMultiInstance, tmApartment);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement