Reading a GUID Property from COM object with C++Builder -
I have a third party COM object with which I am working. . Most okay, but I'm stuck on reading a GUID property from the object
The auto-generated component looks like the rapper / header's relevance:
/ / * ******************************************************************************************** ************************************************************************************************* ** ************** // DispIntf: IFoo // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {5DE5DAAF-5419-4B2B-9771 -58EAEE780799 } // ***************************************************************************************** ****************************************************************************************** template Square T & gt; Class IFooDispT: Public TAutoDriver & lt; IFoo & gt; {... BSTR __fastcall get_FileName (zero); HRESULT __fastcall get_ProjectGUID (/ * AUTO_PARAM_ERROR (System :: TGUID * value) * / VARIANT * value); HRESULT __fastcall get_ProjectName (BSTR * value / * [out, retal] * /); __property BSTR filename = {read = get_FileName}; __property BSTR ProjectName = {read = get_ProjectName}; Notice how ProjectGUID property AUTO_PARAM_ERROR is marked, and it does not appear in the list of properties. I have tried to read it directly through the code get_ProjectGUID () <> but it is always HRESULT = 0x80070057 (E_INVALID_ARGS) . The dispinterface from the IDL return OleView looks like this: - [UUID (5DE5DAAF-5419-4B2B-9771-58EAEE780799), version (1.0), helpstring ( "Dispatch Interface for xpCOMFoo Object"), Dual] IFoo Design {Properties: Methods: & lt; ... hop ... & gt; [ID (0x000000 cf, propagate) BSTR filename (); [Id (0x000000d0), propget] GUID ProjectGUID (); [Id (0x000000d1), propget] BSTR ProjectName (); };
I have tested the same object from Delphi (though, not using the late binding shown above) and I'm glad that the COM object is not a mistake
Try calling this way:
code > TAutoDriver & LT; IFoo & gt; Foo; // ... GUID guid; Mamateset (& guid, 0, sizeof (guid)); // Usage - & gt; To use raw double interface HRESULT hr = foo- & gt; Get_ProjectGUID (& guid);
Comments
Post a Comment