- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am developing a Fortran COM server for my VB client. I would like to provide an enum as a parameter in one of my methods. The Fortran COM Wizard unfortunate doesn't support this.
I did get it to partially work by modifying the idl file to include my typedef with uuid which contained my enum. This exposed the enum to the VB client, no problem.
I changed the IDispatch method's variable to the enum name. The VB client now could see variable was of my enum type, no problem.
However the intellisense does not pop up a list of valid enum names.
This is the problem, I want my clients to be able to pick from a valid list of values.
Is there some example code that shows how to implement this functionality. I can't find very much in the help file about enum in COM servers.
Thanks In Advance,
CM
I did get it to partially work by modifying the idl file to include my typedef with uuid which contained my enum. This exposed the enum to the VB client, no problem.
I changed the IDispatch method's variable to the enum name. The VB client now could see variable was of my enum type, no problem.
However the intellisense does not pop up a list of valid enum names.
This is the problem, I want my clients to be able to pick from a valid list of values.
Is there some example code that shows how to implement this functionality. I can't find very much in the help file about enum in COM servers.
Thanks In Advance,
CM
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using a tag with your typedef? You should have something like :
hth,
John
typedef [v1_enum] enum Mycolors { jtRed=0, jtGreen=1, jtBlue=2, } Mycolors;
hth,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I just tried:
typedef enum tagFOOE {
FOOE_0 = 0,
FOOE_1 = 1,
} FOOE;
// Interfaces for Foo
[
object,
uuid(E3DCE7A6-DDA3-11D4-8096-0090000478FE) ,
oleautomation ,
dual
]
interface IFoo : IDispatch {
[id(1)] HRESULT M1 (
[in] FOOE Arg1);
};
And the enum values showed up in VB intellisense.
I'll add defining enums to the wizard "wish list".
Leo
I just tried:
typedef enum tagFOOE {
FOOE_0 = 0,
FOOE_1 = 1,
} FOOE;
// Interfaces for Foo
[
object,
uuid(E3DCE7A6-DDA3-11D4-8096-0090000478FE) ,
oleautomation ,
dual
]
interface IFoo : IDispatch {
[id(1)] HRESULT M1 (
[in] FOOE Arg1);
};
And the enum values showed up in VB intellisense.
I'll add defining enums to the wizard "wish list".
Leo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A couple things that may or may not be obvious,
When the enum name (tag) and the typedef'd name are different, both names will show up in the type library and in the VB Object Browser. So, for example in the prior posts, both tagFOOE and FOOE would show up as enums in the VB Object Browser in one case, but only MyColors would show up in the other.
Also, if you are using the MIDL generated proxy/stub with DCOM, the MIDL docs mention that the default DCOM wire representation for enums is 16-bit integers; use the [v1_enum] IDL attribute to change this to 32-bit. I always add it out of habit.
The grunge of mapping IDL to type libraries and the fact that there even exists these two formats for representing type information in COM and that there is a loss of fidelity between the two are all fixed in .NET (see .NET metadata and reflection)
hth,
John
When the enum name (tag) and the typedef'd name are different, both names will show up in the type library and in the VB Object Browser. So, for example in the prior posts, both tagFOOE and FOOE would show up as enums in the VB Object Browser in one case, but only MyColors would show up in the other.
Also, if you are using the MIDL generated proxy/stub with DCOM, the MIDL docs mention that the default DCOM wire representation for enums is 16-bit integers; use the [v1_enum] IDL attribute to change this to 32-bit. I always add it out of habit.
The grunge of mapping IDL to type libraries and the fact that there even exists these two formats for representing type information in COM and that there is a loss of fidelity between the two are all fixed in .NET (see .NET metadata and reflection)
hth,
John

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page