• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

The flavours of C++ . net

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
richjo100
Asked:
richjo100
  • 3
  • 3
1 Solution
 
drichardsCommented:
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
 
richjo100Author Commented:
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
 
drichardsCommented:
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
richjo100Author Commented:
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
 
drichardsCommented:
>> 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
 
richjo100Author Commented:
Excellent thank drichards
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now