C++ で C# クラス オブジェクトを作成し、そのメンバー フィールドを設定したいと考えています。C++ クラス オブジェクトを作成することはできますが、そのメンバーにアクセスしてメンバー フィールド値を設定することができません。
/// <summary>
/// Class for AQS Entity
/// </summary>
[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;
}
IEntity クラスは以下で定義されています
[Guid("5C71057E-9FD9-47D5-B022-8D5F9C7007D3")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IEntity
{
}
C++ では、
IEntity* pTest1 = NULL;
hr = CoCreateInstance(__uuidof(**AQSEntity**),NULL,CLSCTX_INPROC_SERVER,__uuidof(IEntity),(void**)&pTest1);
C++でAQSEntityクラスのメンバーにアクセスしたい。しかし、私はそれらにアクセスできません。
pTest1-> sQueryString
エラーを出します。
'sQueryString' : 'AsigraExchange::IEntity' C:\PROJECTS\COM\COMClient\COMClient.cpp 168 のメンバーではありません
誰でも私が間違っている場所を提案できますか?
ありがとう、ガガン