【问题标题】:how to pass a windows structure to a method defined in an interface of an IDL file?如何将windows结构传递给IDL文件接口中定义的方法?
【发布时间】:2010-03-05 01:06:14
【问题描述】:

如果我想将 windows.h 中定义的结构传递给给定接口的方法之一,那么如何在 IDL 中做到这一点?

假设结构为 SECURITY_DESCRIPTOR,在 Winnt.h 中声明;包括 Windows.h 我的界面是

界面假人 { [helpstring("方法 ManageSecurity")]HRESULT ManageSecurity([in]SECURITY_DESCRIPTOR secDesc); }

提前致谢。

【问题讨论】:

    标签: idl


    【解决方案1】:

    我从我们的一个 IDL 文件中提取了以下内容,您只需要做同样的事情。

    typedef [helpstring ("64 bit large integer")] struct {
        long dwLowDateTime;
        long dwHighDateTime;
    } FILETIME;
    
    typedef [helpstring("WIN32_FIND_DATA structure")] struct {
        DWORD dwFileAttributes;
        FILETIME ftCreationTime;
        FILETIME ftLastAccessTime;
        FILETIME ftLastWriteTime;
        DWORD nFileSizeHigh;
        DWORD nFileSizeLow;
        DWORD dwReserved0;
        DWORD dwReserved1;
        unsigned char   cFileName[_MAX_PATH];
        unsigned char   cAlternateFileName[ 14 ];
    } WIN32_FIND_DATA;
    

    您只需要以同样的方式重新定义您自己需要的结构。

    【讨论】:

      猜你喜欢
      • 2017-07-18
      • 1970-01-01
      • 2012-05-25
      • 1970-01-01
      • 2011-06-12
      • 2023-03-08
      • 2018-08-10
      • 2012-06-11
      • 2016-12-19
      相关资源
      最近更新 更多