Advertisement Jump to content
Sign in to follow this  

using .Net components in managed C++

This topic is 4878 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I came across a problem where I have to use a class created in C#.Net in C++. I created a class having the following implementation in c#,

using System;

namespace component
	public class Component
		public Component()

		public void Display()

Then using regasm.exe program I registered the dll as COM. Now I needed to use it in my C++ code. I did the following but I was unable to compile the code. I also added the reference of the created COM component.


const IID IID_Component = {0xA40173F5,0xAE73,0x3E99,{0xBE,0x61,0x52,0x8E,0x8B,0xAA,0xE0,0x8B}}; // This,I looked up from registry

int main(void)

	IUnknown * unknown;
	IUnknown * comp; 

	CoCreateInstance(IID_Component,NULL,CLSCTX_INPROC_SERVER,IID_Component,(LPVOID *)&unknown);

	unknown->QueryInterface(IID_Component,(void **)&comp);


	return 0;

I got the following error d:\main\main\main.cpp(17): error C2039: 'Display' : is not a member of 'IUnknown' I have worked in C++ but haven't done this kind of thing before, so please if I am doing something wrong here please guide me. thanks, Bye.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!