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

Discussion in 'C++' started by Woon Kiat, Aug 18, 2005.

  1. Woon Kiat

    Woon Kiat Guest

    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
     
    Woon Kiat, Aug 18, 2005
    #1
    1. Advertising

  2. 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
     
    =?ISO-8859-1?Q?Stefan_N=E4we?=, Aug 18, 2005
    #2
    1. Advertising

  3. Woon Kiat

    Woon Kiat Guest

    My question is how can I achieve the same thing using Visual C++ .Net?
     
    Woon Kiat, Aug 18, 2005
    #3
  4. 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
     
    =?ISO-8859-1?Q?Stefan_N=E4we?=, Aug 18, 2005
    #4
  5. 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
     
    =?ISO-8859-1?Q?Stefan_N=E4we?=, Aug 18, 2005
    #5
  6. Woon Kiat

    Srini Guest

    > 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
     
    Srini, Aug 18, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. -

    enum within an enum

    -, Jun 12, 2005, in forum: Java
    Replies:
    6
    Views:
    591
  2. Jerminia
    Replies:
    3
    Views:
    661
    Roedy Green
    Oct 7, 2005
  3. Ernst Murnleitner

    How to enum an enum?

    Ernst Murnleitner, Nov 12, 2003, in forum: C++
    Replies:
    5
    Views:
    508
    Rolf Magnus
    Nov 13, 2003
  4. Replies:
    5
    Views:
    640
  5. Replies:
    0
    Views:
    366
Loading...

Share This Page