473,385 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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

Aug 18 '05 #1
5 5084
Woon Kiat wrote:
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
Aug 18 '05 #2
My question is how can I achieve the same thing using Visual C++ .Net?

Aug 18 '05 #3
Woon Kiat wrote:
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

Aug 18 '05 #4
Woon Kiat wrote:
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
Aug 18 '05 #5
> 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

Aug 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: John Smith | last post by:
I have a custom enum to list comparison operators: =, <, <=, >, >= . I have created it as follows: public enum Comparator {Equal, LessThan, LessThanOrEqual,GreaterThan,GreaterThanOrEqual} Now...
21
by: Andreas Huber | last post by:
Hi there Spending half an hour searching through the archive I haven't found a rationale for the following behavior. using System; // note the missing Flags attribute enum Color {
10
by: Ken Allen | last post by:
The ToString() function, when applied to a variable that is an enumeration type, results in a string that is the name of the enumerated value that was defined in the source code. This is cool, but...
3
by: Sanjay Pais | last post by:
I know that string/char enum is not possible in c# (.NET2.0) I need to create the equivalent of this: public enum HOW_GOOD { AWESOME = "A", GREAT= "G", NOT_TOO_BAD = "N", TERRIBLE="T" }
5
by: Alan Cobb | last post by:
Hi, In the managed C++ class below I get compile warning C4677 from VS2003. "signature of non-private function contains assembly private type", even though the managed enum is public. I have...
3
by: Woon Kiat Wong | last post by:
Hi, Using IDL, I can declare my enumeration like following, library MyAppLib { importlib("stdole32.tlb"); importlib("stdole2.tlb"); typedef enum MyColor
6
by: Jason Larion | last post by:
When working with enums, I've noticed some behaviour that seems completely counter-intuitive to me. I was wondering if someone here could help restore my sanity, or at least help me to understand...
2
by: Ray Cassick \(Home\) | last post by:
I have a function that takes a value is as System.Enum and I want to be able to look at that value and determine if it is a regular enum or an enum that has a <Flag()> attribute set on it. I am...
6
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, Suppose I have two enums which has an item with the same names -- but different values, enum foo { NAME = 100;
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.