I have been successful in sending an interface when I send a single Interface parameter in a Task.Comm.Send, but not when it is in an array of constants.
Working Ex:
MyIntf is a IMyIntf
Task.Comm.Send(MSG_LABELDEF, MyIntf);
On the other side:
MSG_LABELDEF: begin //receive the interface
Intf := msg.MsgData.AsInterface;
Intf.QueryInterface(IMyIntf , MyIntf );
frmMain.PrintData(MyIntf);
end;
What I need to do is this (below), but I haven't found a good combination yet. I've also tried variations in casting on the send side.
MyIntf is a IMyIntf
Task.Comm.Send(MSG_LABELDEF, [MyIntf, 'Test');
On the other side:
MSG_LABELDEF: begin //receive the interface
// Intf := msg.MsgData[0]; //Gives EVariantTypeCastError Integer
// to Unknown
// Intf := msg.MsgData[0].AsInterface; //Gives EVariantInvalidOpError 'Invalid
// variant operation;
// Intf := IUnknown(msg.MsgData[0]); //Gives EVariantTypeCastError Integer
// to Unknown
Intf.QueryInterface(IMyIntf , MyIntf );
frmMain.PrintData(MyIntf);
end;