How to declare enum using attribute in VC++ .Net?

W

Woon Kiat

Hi,

Using IDL, I can declare my enumeration like following,

library MyAppLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");

typedef enum MyColor
{
ORANGE = 1,
RED = 2
} MyColor;

}

COM compatible client like VB can use the enum from their application
when import this library. How can I achieve the same thing in Visual
C++ .Net using attribute? I have tried [export] and [v1_enum], but the
enum is only exported to IDL like following

typedef enum MyColor
{
ORANGE = 1,
RED = 2

} MyColor;

library MyAppLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");

........

}

I need the enum to be in the library section. Anyone knows how to solve
this?

regards,
Woon Kiat
 
?

=?ISO-8859-1?Q?Stefan_N=E4we?=

Woon said:
Hi,

Using IDL, I can declare my enumeration like following,

[pseudo code that looks like c++ deleted]

I need the enum to be in the library section. Anyone knows how to solve
this?

regards,
Woon Kiat

And your C++ quetsion is what ?

Stefan
 
?

=?ISO-8859-1?Q?Stefan_N=E4we?=

Woon said:
My question is how can I achieve the same thing using Visual C++ .Net?

So, you want to declare an enum in C++ ?

enum MagicValues
{
ONE = 42,
TWO = 3,
THREE = 0
};

What is the C++ problem you want to solve ?

Stefan
 
?

=?ISO-8859-1?Q?Stefan_N=E4we?=

Woon said:
My question is how can I achieve the same thing using Visual C++ .Net?
Oh, and btw.:

C++ doesn't know anything about '[export] and [v1_enum]'.

Stefan
 
S

Srini

My question is how can I achieve the same thing using Visual C++ .Net?

microsoft.public.dotnet.languages.vc is the correct place to get your
answers.

Srini
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top