Note that there are some explanatory texts on larger screens.

plurals
  1. POInstantiating C# Class Members in C++ using COM
    primarykey
    data
    text
    <p>I would like to create a C# class object in C++ and set its member fields. Although I am able to create a C++ class object, I am unable to access it's members and set member field values.</p> <pre><code>/// &lt;summary&gt; /// Class for AQS Entity /// &lt;/summary&gt; [ClassInterface(ClassInterfaceType.None)] [Guid("70F12A44-B91D-474D-BD70-32B1ACE041D6")] [ProgId("AQSEntity")] public class AQSEntity : IEntity { public AQSEntity() { sRecoveryDBName = String.Empty; arrSourceMailboxesEntity = null; sQueryString = String.Empty; } [MarshalAs(UnmanagedType.BStr)] public string sRecoveryDBName = string.Empty; [MarshalAs(UnmanagedType.ByValArray)] public MailBoxCollection arrSourceMailboxesEntity; [MarshalAs(UnmanagedType.BStr)] public string sQueryString; } </code></pre> <p>and the IEntity class is defined below</p> <pre><code>[Guid("5C71057E-9FD9-47D5-B022-8D5F9C7007D3")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IEntity { } </code></pre> <p>In C++,</p> <pre><code>IEntity* pTest1 = NULL; hr = CoCreateInstance(__uuidof(**AQSEntity**),NULL,CLSCTX_INPROC_SERVER,__uuidof(IEntity),(void**)&amp;pTest1); </code></pre> <p>I want to access members of AQSEntity class in C++. But I am unable to access them.</p> <p>pTest1-> sQueryString </p> <p>gives error. </p> <blockquote> <p>'sQueryString' : is not a member of 'AsigraExchange::IEntity' C:\PROJECTS\COM\COMClient\COMClient.cpp 168</p> </blockquote> <p>Can anyone please suggest where I am wrong.</p> <p>Thanks, Gagan</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload