how can i use vc++ code in C#

HI
i have written code in vc++.But i used c# for GUI .now how can i put the vc++ code in c#.
 


Tariq
tariq6000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sunnycoderCommented:
Hi tariq6000,

Check these tutorials for the same
http://www.codeproject.com/csharp/unmanage.asp
http://msdn.microsoft.com/msdnmag/issues/02/08/CQA/

Cheers!
sunnycoder

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AlexFMCommented:
There are two ways to do this:

1) PInvoke: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp09192002.asp
It works only if C++ library exposes functions (API). If C++ library exposes classes, PInvoke doesn't work.

2) Using C++/CLI wrapper (works both for classes and API). To do this you need to create C++/CLI Class Library and define .NET class which can be called by C# client. Internally C++/CLI class works with unmanaged code. Advantage of using C++/CLI that it can call unmanaged code directly, without using PInvoke - exactly by the same way as it is done in unmanaged C++ client.
tariq6000Author Commented:
if i m using .net framework then what need to unmanaged to maneged
it's respnsobility of clr
 

sunnycoderCommented:
Your question is not clear! Could you please explain what is that you are looking for? ... How to call unmanaged code from managed code has already been posted above.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.