调用COM接口时,出现“没有布局信息”的错误。
代码如下:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
namespace STCSAPI
{
[ComImport, Guid("D3DBD0B0-E0E9-4F46-9591-5754D36D5361")]
public class TCSOrganisationBlockManagerClass
{
}
[Guid("6D16C3FF-6787-46ED-AB2E-58919EBA91F8"), InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface ITCSOrganisationBlockManager
{
int Create([In] ref tcsOrgBlockAttributes_t orgBlockAttributes, [In] ref tcsOrgBlockAttributesMask_t orgBlockAttributesMask, [In] short cookie);
}
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct tcsOrgBlockAttributes_t
{
[MarshalAs(UnmanagedType.ByValArray,SizeConst = 6)]
public ushort [] orgBlockId;
[MarshalAs(UnmanagedType.ByValArray,SizeConst = 32)]
public byte [] orgBlockMnemonic;
[MarshalAs(UnmanagedType.ByValArray,SizeConst = 64)]
public byte[] apn;
public System.UInt32 apnIndex;
public bool apnIndexWithValue;
public tcsApnPoolList_t apnPoolList;
public System.UInt32 homeExchangeId;
[MarshalAs(UnmanagedType.ByValArray,SizeConst = 12)]
public byte[] homeExchangeMnemonic;
}
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct tcsApnPoolList_t
{
[MarshalAs(UnmanagedType.ByValArray,SizeConst = 10)]
public tcsApnPool_t[] apnPoolList;
public System.UInt16 length;
}
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct tcsApnPool_t
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst=16)]
public byte[] apnPoolMnemonic;
public System.UInt16 apnPoolId;
}
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct tcsOrgBlockAttributesMask_t
{
public bool apnIndexPresent;
public bool apnPoolListPresent;
public bool orgBlockMnemonicPresent;
}
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
调用COM的代码如下:
tcsOrgBlockAttributes_t structOrgAttr = new tcsOrgBlockAttributes_t();
tcsOrgBlockAttributesMask_t structOrgMask = new tcsOrgBlockAttributesMask_t();
TCSOrganisationBlockManagerClass aOrg = new TCSOrganisationBlockManagerClass();
ITCSOrganisationBlockManager iOrg=(ITCSOrganisationBlockManager)aOrg;
iOrg.Create(ref structOrgAttr,ref structOrgMask,32);
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
错误信息如下:
无法封送类型 STCSAPI.tcsOrgBlockAttributes_t 的字段 apnPoolList:该字段的类型定义没有布局信息。
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
请高人帮忙看一下,自己查了n多资料也解决不了,实在是无计可施了,特别请qqchen79(知秋一叶)帮忙看一下,不胜感激!