473,770 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Managed code with C# and VC++

I am trying to find the simplest possible way of writing a
GUI to run on top of a standard C++ library written in
VC++. I would like to avoid MFCs, COM, and if
possible .Net wrappers. The goal is just to be able to
demonstrate the capabilities of the library, rather than
create a finished product.

I have read things here and there about "managed code",
where you can write a GUI in C# to interface with
C++ "unmanaged" code. However, after searching through
pages and pages on MSDN, plus external sites, I remain
more confused than ever. If anyone could help answer the
following questions, or point me to some useful references
on the web or in print, I would greatly appreciate it.

1. Does managed/unmanaged code (using C# and VC++) allow
you to bypass MFCs and COM?

2. If so, is it still necessary to write some type of .Net
wrapper to instantiate the C++ objects?

3. Can this be done with the standard .Net 2003 versions
of C# and VC++, or does it require purchasing .Net
Professional?

Again, any feedback or references would be appreciated.

Thanks in advance.

Nov 13 '05 #1
3 3599
Francis,

See inline:

"Francis Urquhart" <fr************ **@yahoo.co.jp> wrote in message
news:09******** *************** *****@phx.gbl.. .
I am trying to find the simplest possible way of writing a
GUI to run on top of a standard C++ library written in
VC++. I would like to avoid MFCs, COM, and if
possible .Net wrappers. The goal is just to be able to
demonstrate the capabilities of the library, rather than
create a finished product.

I have read things here and there about "managed code",
where you can write a GUI in C# to interface with
C++ "unmanaged" code. However, after searching through
pages and pages on MSDN, plus external sites, I remain
more confused than ever. If anyone could help answer the
following questions, or point me to some useful references
on the web or in print, I would greatly appreciate it.

1. Does managed/unmanaged code (using C# and VC++) allow
you to bypass MFCs and COM?
Yes, it does. You can write managed code which accesses unmanaged code,
but that unmanaged code has to provide a managed interface of some sort.

2. If so, is it still necessary to write some type of .Net
wrapper to instantiate the C++ objects?
Yes, it is. Otherwise, the runtime would have no clue how to interact
with the unmanaged code.

3. Can this be done with the standard .Net 2003 versions
of C# and VC++, or does it require purchasing .Net
Professional?
You should be able to do it without the IDE, you should be able to do it
with just the .NET framework (although it would be a little more difficult,
as everything is from the command line).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

Again, any feedback or references would be appreciated.

Thanks in advance.

Nov 13 '05 #2
Francis,

I would definitely use C# for the GUI code. It would probably be easier
(IMO), but it all depends on what you are used to. If you can create the
wrappers for your classes, then you really have 95% of the work done, as
there is little to do after that besides create the GUI. If you have
complex GUI requirements, then I would use C++, but if your requirements are
pretty standard, then I would use C# to call your wrapped classes.
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"Francis Urquhart" <fr************ **@yahoo.co.jp> wrote in message
news:0e******** *************** *****@phx.gbl.. .
Nicholas,

Thanks for your reply. That definitely helps.

Just one follow-up: Would you recommend the C# route
rather than just trying to create a GUI using VC++ alone?
That is, would it be a simpler process to create the .Net
wrapper and code the GUI in C# rather than using the GUI
tools in VC++ (especially if I were to use the .Net
Professional IDE)?

Sorry for all the questions -- I've been working with UNIX
the past five years and know very little about the .Net
environment.

-Francis

-----Original Message-----
Francis,

See inline:

"Francis Urquhart" <fr************ **@yahoo.co.jp> wrote

in message
news:09******* *************** ******@phx.gbl. ..
I am trying to find the simplest possible way of writing a GUI to run on top of a standard C++ library written in
VC++. I would like to avoid MFCs, COM, and if
possible .Net wrappers. The goal is just to be able to
demonstrate the capabilities of the library, rather than
create a finished product.

I have read things here and there about "managed code",
where you can write a GUI in C# to interface with
C++ "unmanaged" code. However, after searching through
pages and pages on MSDN, plus external sites, I remain
more confused than ever. If anyone could help answer the following questions, or point me to some useful references on the web or in print, I would greatly appreciate it.

1. Does managed/unmanaged code (using C# and VC++) allow
you to bypass MFCs and COM?


Yes, it does. You can write managed code which

accesses unmanaged code,
but that unmanaged code has to provide a managed

interface of some sort.

2. If so, is it still necessary to write some type of .Net wrapper to instantiate the C++ objects?


Yes, it is. Otherwise, the runtime would have no

clue how to interact
with the unmanaged code.

3. Can this be done with the standard .Net 2003 versions
of C# and VC++, or does it require purchasing .Net
Professional?


You should be able to do it without the IDE, you

should be able to do it
with just the .NET framework (although it would be a

little more difficult,
as everything is from the command line).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

Again, any feedback or references would be appreciated.

Thanks in advance.

.

Nov 13 '05 #3
Nicholas,

Thanks for your reply. That definitely helps.

Just one follow-up: Would you recommend the C# route
rather than just trying to create a GUI using VC++ alone?
That is, would it be a simpler process to create the .Net
wrapper and code the GUI in C# rather than using the GUI
tools in VC++ (especially if I were to use the .Net
Professional IDE)?

Sorry for all the questions -- I've been working with UNIX
the past five years and know very little about the .Net
environment.

-Francis

-----Original Message-----
Francis,

See inline:

"Francis Urquhart" <fr************ **@yahoo.co.jp> wrote in messagenews:09******* *************** ******@phx.gbl. ..
I am trying to find the simplest possible way of writing a GUI to run on top of a standard C++ library written in
VC++. I would like to avoid MFCs, COM, and if
possible .Net wrappers. The goal is just to be able to
demonstrate the capabilities of the library, rather than
create a finished product.

I have read things here and there about "managed code",
where you can write a GUI in C# to interface with
C++ "unmanaged" code. However, after searching through
pages and pages on MSDN, plus external sites, I remain
more confused than ever. If anyone could help answer the following questions, or point me to some useful references on the web or in print, I would greatly appreciate it.

1. Does managed/unmanaged code (using C# and VC++) allow
you to bypass MFCs and COM?
Yes, it does. You can write managed code which

accesses unmanaged code,but that unmanaged code has to provide a managed interface of some sort.

2. If so, is it still necessary to write some type of .Net wrapper to instantiate the C++ objects?
Yes, it is. Otherwise, the runtime would have no

clue how to interactwith the unmanaged code.

3. Can this be done with the standard .Net 2003 versions
of C# and VC++, or does it require purchasing .Net
Professional?
You should be able to do it without the IDE, you

should be able to do itwith just the .NET framework (although it would be a little more difficult,as everything is from the command line).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

Again, any feedback or references would be appreciated.

Thanks in advance.

.

Nov 13 '05 #4

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

Similar topics

23
2239
by: Bredal Jensen | last post by:
I want to port my MFC (VC++6) application to manageg VC ++. 7. I want to do this because some things are much better done with C#. So i could write a C# class and use in my VC++ code as Languague interoperability is one of the main features of the .Net framework. I know my application would have to obey to the CTS (common type specification) but my main concerns are the MFC stuff! I do not really know which options you have with windows...
6
2766
by: Shai Levi | last post by:
Hi, I'm trying to migrate native c++ class to managed c++ class. The native class header definition looks as: class NativeClass { public: typedef void (CbFunc1)(int n,void* p);
6
2295
by: Itay_k | last post by:
Hello, I want a member in my class that will save pointer to pointer to System::Drawing::Image class. When I write on my class code: System::Drawing::Image **bmp; I get this error message: error C3160: 'bmp' : cannot declare interior __gc pointer or reference as a
1
1839
by: Omid Hodjati | last post by:
Hi All, I have an old unmanaged code written in C++ 6.0. This is a time critcal, CPU bound application. I have deciede migrate this application to managed world and VC++ 7.0. The first step was to compile the 6.0 version with /clr to IL code....That was succesful ... I made clean build ! But the application didn't run. When I profiled the application execustion i saw that the managed version is 2 times slower that unmanaged version. This...
1
2127
by: Eric Twietmeyer | last post by:
Hello, I'm starting to investigate cs, managed c++ and interoperating with a very large unmanaged code base. We are going to use Windows Forms (written in cs) to replace our old fashioned GUI. The guts will remain in unmanaged c++. So I need to write public managed c++ wrapper classes for the couple of interfaces the unmanaged stuff needs to expose for the GUI. Questions:
1
1419
by: Peter Nolan | last post by:
Hi All, I'm interested in the opinion of an expert or two on managed C++.net. I've been writing cross platform C++ (win/unix) for some ETL tools I use with clients. All the code is 'unmanaged' as I originally wrote it in VC++ 6. I've just completed my first managed code program. I also bought the book VC++.NET 'Step by Step' Version 2003 and been reading that as fast as I can. So all this 'managed code' and .net features of C++ are
11
1825
by: Peter Oliphant | last post by:
Is there any plan to support templates with managed code in the (near) future? For instance, VS.NET 2005... : )
5
2404
by: Andy | last post by:
I'm having trouble accessing an unmanaged long from a managed class in VC++.NET When I do, the contents of the variable seem to be mangled. If I access the same variable byte-by-byte, I get the correct value. Regardless what I set the variable to, the value that is returned for a long is always the same value. What's going on...can anyone help me? A short version of the code follows:
3
4711
by: Klaus | last post by:
Hi, I have an existing VC 6 MFC application which communicates asynchronly with a VC 2005 managed code dll. I use an unmanaged base class with virtual functions to access methods in the MFC application. Furthermore, I use a pointer to an unmanaged function to jump back into the managed dll. The managed part is basically a remoting enhancement which asynchronly
0
9595
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9873
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
8891
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...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
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
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2822
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.