Board index » cppbuilder » Import Type Library Wizard not working with events that utilise "retval"
Mischa Simmonds
CBuilder Developer |
Import Type Library Wizard not working with events that utilise "retval"2007-10-17 09:31:28 AM cppbuilder102 I have started a similar thread to this before, but feel it may be appropriate to start afresh as the problem is a bit more defined now. I have a third party ActiveX object that fires an event that uses "retval" (ie: I should be able to modify the value and return it to the server). However, the Import Type Library Wizard tries to handle this within InvokeEvent, and also, unless one removes the reference to the "retval" in the function it will not compile. It seems like I have to handle this event differently to others but I can't work out how. Any tips or ideas on this? typedef void __fastcall (__closure * TPartitionManagerPreTransmit)(System::TObject * Sender, BSTR Entry/*[in]*/, BSTR* updatedEntry/*[out,retval]*/);//Compiler fails unless I remove reference to this !! class PACKAGE TPartitionManager : public Oleserver::TOleServer { IPartitionManagerPtr m_DefaultIntf; _di_IUnknown __fastcall GetDunk(); public: __fastcall TPartitionManager(TComponent* owner) : Oleserver::TOleServer(owner) {} IPartitionManagerPtr& GetDefaultInterface(); void __fastcall InitServerData(); void __fastcall Connect(); void __fastcall Disconnect(); void __fastcall BeforeDestruction(); void __fastcall ConnectTo(IPartitionManagerPtr intf); virtual void __fastcall InvokeEvent(int DispID, Oleserver::TVariantArray& params); ... private: ... TPartitionManagerPreTransmit FOnPreTransmit; __published: __property TPartitionManagerPreTransmit OnPreTransmit={ read=FOnPreTransmit, write=FOnPreTransmit }; }; void __fastcall TPartitionManager::InvokeEvent(int id, Oleserver::TVariantArray& params) { switch(id) { ... case 6: { if (OnPreTransmit) { (OnPreTransmit)(this, TVariant(params[0]));//compiler wants an extra parameter here, which is wrong!!! } break; } default: break; } } |