zoukankan      html  css  js  c++  java
  • atl常量暴露的最简便方法

    [摘自ActivX Faqs]
    说明:
    只需在idl文件的类库声明中,定义枚举常量,就可以将atl常量暴露给客户程序。

    例子:
    import "oaidl.idl";
    import "ocidl.idl";
    #include "olectl.h"
     

     [
      object,
      uuid(D6719E8B-B2F3-49A6-B985-E30ED36E472B),
      dual,
      helpstring("Iqqq Interface"),
      pointer_default(unique)
     ]
     interface Iqqq : IDispatch
     {
     };

    [
     uuid(A78593FE-FAF1-4491-BBC1-128D12021769),
     version(1.0),
     helpstring("test6 1.0 Type Library")
    ]
    library TEST6Lib
    {
     importlib("stdole32.tlb");
     importlib("stdole2.tlb");

       typedef enum NoteItControlStatus
      {
         STATUS_SUCCESS = 1,
         STATUS_INFORMATIONAL = 2,
         STATUS_WARNING = 4,
         STATUS_FAILURE = 8
      } NOTEIT_CONTROL_STATUS;

     [
      uuid(152EF1F9-E2B6-4AF6-978C-4253B38227EC),
      helpstring("qqq Class")

      

     ]
     coclass qqq
     {
      [default] interface Iqqq;
     };
    };

    原文:
    How can I expose constants from my controls?
     
     

    --------------------------------------------------------------------------------
     
    You can use the standard IDL enum keyword. The trick is to make sure the declaration is inside the library section. Here's an example:

    typedef enum NoteItControlStatus
    {
       STATUS_SUCCESS = 1,
       STATUS_INFORMATIONAL = 2,
       STATUS_WARNING = 4,
       STATUS_FAILURE = 8
    } NOTEIT_CONTROL_STATUS;
     

  • 相关阅读:
    Account group in ERP and its mapping relationship with CRM partner group
    错误消息Number not in interval XXX when downloading
    错误消息Form of address 0001 not designated for organization
    Algorithm类介绍(core)
    梯度下降与随机梯度下降
    反思
    绘图: matplotlib核心剖析
    ORB
    SIFT
    Harris角点
  • 原文地址:https://www.cnblogs.com/youyou/p/271257.html
Copyright © 2011-2022 走看看