473,387 Members | 1,290 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How can I use managed with unmanged code



I would be pleased if someone gives me a general idea; how I am going to do
this. I am using visual C++ .NET 2003.

I made a simple program using conventional C++ code. This program accepts
data from the user, does some calculations and outputs the result back to
the user using the console.

Now, I want to use the .NET Framework to interact with the user through
Forms, Dialog Boxes and Controls.

I managed to create all the forms that I need to interact with the user and
they work very well together. But, now I want to use the first program that
I made from conventional C++ with .NET Framework. In other words I want the
user to input data (through Forms and controls) and then I want to
manipulate the data mathematically (using the conventional C++ code) and out
put the result (through other Forms and controls).

So my question is how can I use the conventional C++ code with the managed
code and which file(s) am I going to use? For example, I have the following
files:-

References:

...

...

Source Files:

AssemblyInfo.cpp

Form1.cpp

Form2.cpp

Form3.cpp

Stdafx.cpp

Header Files:

Form1.h

Form2.h

Form3.h

Resource.h

Stdafx.h

Resource Files:

...

...

...

ReadMe.txt

Allen
May 29 '07 #1
1 1154

Generally if have methods in c++ you may use pinvoke.

If your libraries are COM objects, you may use COM interop.
Following links may be helpful to you.

Using C++ Interop (Implicit PInvoke)

http://msdn2.microsoft.com/en-us/lib...zx(VS.80).aspx

Calling Native Functions from Managed Code
http://msdn2.microsoft.com/en-us/lib...82(VS.80).aspx

"Allen Maki" wrote:
>

I would be pleased if someone gives me a general idea; how I am going to do
this. I am using visual C++ .NET 2003.

I made a simple program using conventional C++ code. This program accepts
data from the user, does some calculations and outputs the result back to
the user using the console.

Now, I want to use the .NET Framework to interact with the user through
Forms, Dialog Boxes and Controls.

I managed to create all the forms that I need to interact with the user and
they work very well together. But, now I want to use the first program that
I made from conventional C++ with .NET Framework. In other words I want the
user to input data (through Forms and controls) and then I want to
manipulate the data mathematically (using the conventional C++ code) and out
put the result (through other Forms and controls).

So my question is how can I use the conventional C++ code with the managed
code and which file(s) am I going to use? For example, I have the following
files:-

References:

...

...

Source Files:

AssemblyInfo.cpp

Form1.cpp

Form2.cpp

Form3.cpp

Stdafx.cpp

Header Files:

Form1.h

Form2.h

Form3.h

Resource.h

Stdafx.h

Resource Files:

...

...

...

ReadMe.txt

Allen
May 29 '07 #2

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

Similar topics

1
by: lolomgwtf | last post by:
I have a managed C++ method that wraps unmanaged code and creates a managed object holding data retrieved form an unmanged one. I want create an instance of this managed class in C#, pass it to...
3
by: Mr Topom | last post by:
Hello, I have a C++ (unmanaged) class named K in a DLL. I create a managed C++ class named K in an other DLL that wrapped the unmanaged one. To refer the unmanaged one I use ::K and the...
2
by: lolomgwtf | last post by:
I have a managed C++ method that wraps unmanaged code and creates a managed object holding data retrieved form an unmanged one. I want create an instance of this managed class in C#, pass it to...
2
by: Brett Styles | last post by:
Hi Guys, I am trying to access a class in an unmanaged dll. I have created a wrapper managed class to access the functions I need but no matter what I try from the MSDN samples I can not get it to...
2
by: Sandy | last post by:
I am confused about Unmanaged Code, How .Net Framework treate that code, What is the use of that. Thanks in advance Sandeep Chitode
5
by: Maxwell | last post by:
Hello, Newbie question here. I have a VS.NET 2003 MC++ (not C++/cli) project where I have a managed class reference in a unmanaged class...simple enough. To keep things short I am for the most...
1
by: mschuck | last post by:
Here is the scenario I'm trying to make work. I've got 2 managed C++ classes, each of which wrappes an unmanaged C++ class, kind of like so: __nogc class UnmanagedClassA { public: void...
6
by: B. | last post by:
my small project has two files, umg.cpp (unmanaged c++) and mged.cpp (MC++), and unmanged code will call managed code. However, I cannot debug from unmanged code into managed code. Can anyone help...
5
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I have a class that is writen in unmanaged pure native C++. This class files (h and cpp) are inserted to a managed C++ (VC++ 2005, C++/CLI) DLL compoenet. This DLL compoenet is used in a C#...
0
by: ElysianEagle | last post by:
Hi, I have a DLL written in C that creates a structure as a local variable, populates it, and then calls a function in managed c#. here is what im talking about: //-----unmanged code's header...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.