For Example: var MyObject:TCoCo; m_CoCo:ICoCo; Begin MyObject:=TCoCo.Create(10); ... m_Coco:=MyObject; { When I add "as ICoCo" fellow "MyObject",there is an error as fellowing when run the program:"Interface Not supported". But if I use CoCreateInstance(CLASS_CoCo,nil,CLSCTX_SERVER,IID_ICoCo,m_CoCo), all is right.} m_CoCo.Dosth();
var MyObject:TCoCo;
m_CoCo:ICoCo;
Begin
MyObject:=TCoCo.Create(10);
...
m_Coco:=MyObject;
{ When I add "as ICoCo" fellow "MyObject",there is an error as fellowing when run the program:"Interface Not supported".
But if I use CoCreateInstance(CLASS_CoCo,nil,CLSCTX_SERVER,IID_ICoCo,m_CoCo), all is right.}
m_CoCo.Dosth();