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
Rodrigo Corral [MVP] - 18 Aug 2005 08:55 GMT
Here you have an example. This code is working for me in and ATL Attributed
project.
Tell us if it works or not.
[
export,
uuid("CCA6D17A-17F9-47d2-86AD-DB64B273B5C1"),
helpstring("MsgType"),
library_block
]
enum eMsgType
{
mtA = 1,
mtB = 2,
mtC = 3,
mtD = 4
}

Signature
Un saludo
Rodrigo Corral González [MVP]
FAQ de microsoft.public.es.vc++
http://rcorral.mvps.org
Woon Kiat - 18 Aug 2005 09:05 GMT
Thank you, it's working!
Rodrigo Corral [MVP] - 11 Sep 2005 00:23 GMT
I´m glad to hear this.

Signature
Un saludo
Rodrigo Corral González [MVP]
FAQ de microsoft.public.es.vc++
http://rcorral.mvps.org