简体   繁体   中英

adding enum to ATL DLL in visual studio 2010

I created c++ project in VS2010 as follows: 1 - new project -> Visual c++ -> ATL -> ATl Project -> selected DLL. 2 - right click on the created project -> add -> class -> ATL -> ATL Simple Object . Then I wrote all required information. 3 - then I went to Class View wizard -> right click on the interface -> add method or property.

all this allows me to add a method or property to the interface. but How can I add enum to the interface?

I created ATL DLL project that will be called by C#/ VB. I am trying to add a read only object to the interface that provides the status of the dll's operation. So I thought of adding enum. is there a better way?

thanks for any help

You can enter the enum manually in the IDL by using the same syntax as in C++:

enum MyEnum
{
  VAL1,
  VAL2,
  ...
};

When using it as an argument type you need to put the keyword "enum" in front of your Enum's name:

[propget] HRESULT MyProp([out, retval] enum MyEnum* pVal);

In the C++ header/source do not use "enum" in front of MyEnum.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM