473,796 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Moving interface & enum from IDL to C++/CLI

I am working on a project that currently has some interfaces and enums
defined in an IDL file. The sole implementor of these interfaces are
now in C++ CLI, but I still have consumers that are in unmanaged C++.
I would like to move the interface and enum definitions to the C++ CLI
code, but I cannot figure out what shape it should take:

typedef [ uuid(4E803D49-2EB8-450a-BD00-DC8336D1E6B5) ]
enum {
associate,
chief,
boss
} MemberTypeEnum;

[
object,
uuid(F1A27469-9E22-41dd-A905-F76C7DB0BE51),
dual,
nonextensible,
pointer_default (unique)
]
interface IMember : IDispatch {
[id(1), propget] HRESULT Name([out, retval] BSTR* pRetVal);
[id(2), propget] HRESULT Address([out, retval] BSTR* pRetVal);
[id(3), propget] HRESULT Phone([out, retval] BSTR* pRetVal);
[id(4), propget] HRESULT Joined([out, retval] DATE* pRetVal);
[id(5), propget] HRESULT MemberType([out, retval] MemberTypeEnum*
pRetVal);
};

to

typedef [ uuid(4E803D49-2EB8-450a-BD00-DC8336D1E6B5) ]
enum MemberTypeEnum {
associate,
chief,
boss
};

[uuid("F1A27469-9E22-41dd-A905-F76C7DB0BE51")]
public interface class IMember
{
property String^ Name { get(); };
property String^ Address { get(); };
property String^ Phone { get(); };
property DateTime Joined{ get(); };
property MemberTypeEnum MemberType();
};

Aug 12 '07 #1
1 3762
you can create a type library

--
Sheng Jiang
Microsoft MVP in VC++
"Cartoper" <ca******@gmail .comwrote in message
news:11******** **************@ q4g2000prc.goog legroups.com...
I am working on a project that currently has some interfaces and enums
defined in an IDL file. The sole implementor of these interfaces are
now in C++ CLI, but I still have consumers that are in unmanaged C++.
I would like to move the interface and enum definitions to the C++ CLI
code, but I cannot figure out what shape it should take:

typedef [ uuid(4E803D49-2EB8-450a-BD00-DC8336D1E6B5) ]
enum {
associate,
chief,
boss
} MemberTypeEnum;

[
object,
uuid(F1A27469-9E22-41dd-A905-F76C7DB0BE51),
dual,
nonextensible,
pointer_default (unique)
]
interface IMember : IDispatch {
[id(1), propget] HRESULT Name([out, retval] BSTR* pRetVal);
[id(2), propget] HRESULT Address([out, retval] BSTR* pRetVal);
[id(3), propget] HRESULT Phone([out, retval] BSTR* pRetVal);
[id(4), propget] HRESULT Joined([out, retval] DATE* pRetVal);
[id(5), propget] HRESULT MemberType([out, retval] MemberTypeEnum*
pRetVal);
};

to

typedef [ uuid(4E803D49-2EB8-450a-BD00-DC8336D1E6B5) ]
enum MemberTypeEnum {
associate,
chief,
boss
};

[uuid("F1A27469-9E22-41dd-A905-F76C7DB0BE51")]
public interface class IMember
{
property String^ Name { get(); };
property String^ Address { get(); };
property String^ Phone { get(); };
property DateTime Joined{ get(); };
property MemberTypeEnum MemberType();
};

Aug 13 '07 #2

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

Similar topics

13
9558
by: SpaceCowboy | last post by:
I recently got into a discussion with a co-worker about using enums across a dll interface. He wanted to use chars instead, argueing that depending on compiler settings the size of an enum could change and lead to memory corruption. I didn't see how this was possible. He claims that if a dll built for a program is built with different compiler settings than the launcher program, the enum size could change. The only way I could figure...
1
16704
by: Torben Madsen | last post by:
I need a intereface so that i get the same structure in several arrays that i create. I think that i need to use enum in a interface. Abstract classes don't do the job as i need to inherit from several interfaces. This doesn't Work. Any ideas? using System; namespace well_test { public interface IMeassurement
2
5949
by: David | last post by:
hello... how can i use IActiveDesktop COM interface from shell32.dll? thanx...
2
2843
by: matthew_glen_evans | last post by:
Hi there, Quick one about interfaces in c#. It seems that it is illegal to declare types within an interface. I was quite used to doing this in VB.net where the interface can define a clients remoting interface and object model. eg..
0
1425
by: Robin Tucker | last post by:
I need to create my own explorer-style control - I don't seem to have access to IShellFolder - assuming I need it (which I think I do), how can this be done? I've imported shell32.dll into my references. I've seen a C# version of how to do it, but I have no idea how to translate this into VB :-0. (C# version below, no idea if it works or not!)
2
20147
by: Cristiano de Pádua Milagres Oliveira | last post by:
What do I to declare the header of a Property in an Interface, and should this property return a generic Enum? Example: public interface IMetric { Enum Unit { get;} } public class ClassTest : IMetric
3
3758
by: Andrew Bainbridge | last post by:
Hi, I'm converting some code over from vb.net to c# and have the following issue. In VB you can have enum's within an interface. i.e. Public Interface Class1 Enum ColorType Black Red
13
5016
by: Bob | last post by:
Hi, Can someone explain why you can't declare enums in an interface? The compiler says "interfaces can't declare types" Ignoring the syntax implications it seems to me that you should be able to declare that an enum exists. i.e. It is within the 'spirit' of an interface to state that it exists. The implementing class will provide the members. e.g. I have a code library that performs a function. It exposes two interfaces which allow for...
0
905
by: habakkuk | last post by:
Hi, I gotten Protected Memory Error while trying to access the C++ interface from C#, I am wandering is it something is not correct on my interpretation from C++ to C#. Below is the C++ Interface code and next to it is my C# code. //*************** C++ Code ***************************************************** // {AEB23DA0-54BB-11d2-BD98-0080ADB67301} DEFINE_GUID(IID_IAudioOutput, 0xaeb23da0, 0x54bb, 0x11d2, 0xbd, 0x98, 0x0, 0x80, 0xad,...
0
10221
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10169
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.