Click here to Skip to main content
15,885,546 members
Articles / Programming Languages / C++/CLI

Using managed code in an unmanaged application

Rate me:
Please Sign up or sign in to vote.
4.69/5 (24 votes)
4 Apr 20055 min read 197.7K   2.8K   63  
How to use your managed class libraries in your unmanaged application, using IJW.
// MessageBoxWrapper.cpp: implementation of MessageBoxWrapper and class factory

#include "IMessageBoxWrapper.h"
#include "MessageBoxWrapper.h"

void	MessageBoxWrapper::Show(std::string message)
{
	_managedObject = gcnew MessageBoxShower(gcnew System::String(message.c_str()));
	_managedObject->Show();
}

IMessageBoxWrapper	*IMessageBoxWrapper::CreateInstance()
{
	return ((IMessageBoxWrapper *)new MessageBoxWrapper());
}

void				IMessageBoxWrapper::Destroy(IMessageBoxWrapper *instance)
{
	delete instance;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
France France
Born in 1984. Got a computer at 12. Started programming at 14 with VB6.
Actually in third year at the Epitech school in Paris, France.
And part time working at the IMARA project at INRIA.

Comments and Discussions