Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

The flavours of C++ . net

Posted on 2004-10-29
6
Medium Priority
?
262 Views
Last Modified: 2013-11-25
Hi all
i am new to visual c++ .net  and am getting mightily confused.

I am in the process of writing an mfc application and a dll for it to communicate with.

When coding the dll I wanted to construct/split a file path. I am using _makepath and _splitpath which I obtained from another questino on this website.

However when I look at the msdn it says if I want the file name of a path I can use the FileName property. I am gettign confused. I see the filename property is in the .net framework where as _makepath etc are in the visual C++ libraries. Has this got something to do with why i can use some functions and not others?

Thanks

Richard
0
Comment
Question by:richjo100
  • 3
  • 3
6 Comments
 
LVL 19

Expert Comment

by:drichards
ID: 12446921
In Visual C++ .NET, you can write plain ANSI C++ or you can write managed C++ which is executed in the .NET CLR.  It sounds like you are writing plain C++ and should avoid any .NET Framework Library classes as they will not work for you.

If you want to use .NET managed C++ functionality, you need to create a Console Application (.NET), a Windows Control Library (.NET), or Windows Forms App (.NET) project.
0
 

Author Comment

by:richjo100
ID: 12451082
Thanks for the reply drichards. So if I start an MFC application is this managed? Can I use .NET framework in this?
Also if I use windows api stuff is this available in all of my projects

Thanks
Richard
0
 
LVL 19

Expert Comment

by:drichards
ID: 12452988
An MFC project is unmanaged.  You can add support for managed code if you really want to use it, but if you're doing that, you should really start with a Windows Forms Appl (.NET) and make it a managed application rather than a mixed one.

If you just wanted to use one or two classes from .NET, find MFC, STL, or other C++ alternatives.  In my opinion, it's not worth doing a mixed mode app unless you're converting a legacy MFC application to interact with new .NET components or writing a new managed app that needs some functionality not available in the .NET class library.  The latter is not likely unless you're doing networking.  It works OK, but can introduce odd performance problems.

In all cases you can use Windows API calls.  In MFC obviously it works as it always has.  If you stay away from managed code there really isn't any difference from what you've done in the past.  If you do managed code, C++ gives you IJW (It Just Works) where you can throw in unmanaged C++ code right along with the managed code.  You can also do explicit PInvokes.  Again, that should only be a last resort.  If you're doing managed code, there are a couple oof things (like some network functions) that will require you to go to the Windows API.
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:richjo100
ID: 12470955
Thanks for your answer drichards.
So am I correct in thinking that .net is a framework that c++.net and c# can use.
Or is .net just another "flavour" of c++ and c# is just a completely different language? From what I know you can get asp.net so does this use the .net framework like C++.net
then?

Richard
0
 
LVL 19

Accepted Solution

by:
drichards earned 280 total points
ID: 12487846
>> So am I correct in thinking that .net is a framework that c++.net and c# can use
That is certainly part of .NET.

>> Or is .net just another "flavour" of c++
No, but MS added some language extensions to C++ to allow you to write managed (.NET) apps in C++.

ASP.NET is an implementation of ASP that executes in the .NET CLR.  Certain file requests are forked off to the ASP.NET process which is a .NET application.  This allows your ASP.NET pages to utilize the features of the .NET framework.
0
 

Author Comment

by:richjo100
ID: 12492434
Excellent thank drichards
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question