What I am trying to do is transfer an object that has been created on the serverside to the client. I have got it to work well when I using c++ on both server and client side, but I do not get my server to work correct with other languages like .Net, It probably doesn't like the pointers!
Does this Serversidecode look correct?
Server Form: .h
class TForm2 : public TForm
{
__published: // IDE-managed Components
TMemo *Memo1;
private: // User declarations
DummyComObj* formDummy;
public: // User declarations
__fastcall TForm2(TComponent* Owner);
IDummyComObj* Getformdummy();
};
.cpp
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
CoCreateInstance( CLSID_DummyComObj,NULL,CLSCTX_ALL,IID_IDummyComObj,(void**)&formDummy);
}
DummyComObj* TForm2::Getformdummy()
{
return formDummy;
}
Server TestComServerImpl: .cpp
STDMETHODIMP STDMETHODCALLTYPE TServerDidleComTestImpl::GetMyObject(IDummyComObj** outObj)
{
DummyComObj *myDum = Form2->Getformdummy();
*outObj = &myDum;
return S_OK;
}