C#问题中的C ++结构编组 [英] C++ structure marshalling in C# problem

查看:72
本文介绍了C#问题中的C ++结构编组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在从C#代码中调用tDeviceProperty结构.我尝试了很多选择,但仍然无法正常工作.任何人都可以帮助我在C#中编组此代码.

提前谢谢.

Hi,

I am calling tDeviceProperty structure from My C# code. I tryed lot of options but still not working. Can any one help me in marshalling this code in C#.

Thanks in advance.

typedef struct _FILETIME {
    DWORD dwLowDateTime;
    DWORD dwHighDateTime;
} FILETIME, *PFILETIME, *LPFILETIME;

#define _FILETIME_

#if defined(MIDL_PASS)

typedef struct _LARGE_INTEGER {

#else

typedef union _LARGE_INTEGER {

    struct {
        DWORD LowPart;
        LONG HighPart;
    };

    struct {
        DWORD LowPart;
        LONG HighPart;
    } u;

#endif

    LONGLONG QuadPart;

} LARGE_INTEGER;



typedef LARGE_INTEGER *PLARGE_INTEGER;



struct tDeviceProperty {
      DWORD Tag;
      DWORD Size;
      union _DP value;
};



typedef union _DP

{
      short int           i;
      LONG                l;
      ULONG               ul;
      float               flt;
      double              dbl;
      BOOL        b;
      double              at;
      FILETIME            ft;
      LPSTR               lpszA;
      LPWSTR              lpszW;
      LARGE_INTEGER       li;
      struct tBinary    bin;
      BYTE                reserved[40];
} __UDP;



struct tBinary {
      ULONG size;
      BYTE * bin;
};

推荐答案

如果您分享以前的工作,对我们会有所帮助. :)
It would be helpful for us if you share what you did earlier. :)


这篇关于C#问题中的C ++结构编组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆