Solved

The flavours of C++ . net

Posted on 2004-10-29
214 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
Question by:richjo100
    6 Comments
     
    LVL 19

    Expert Comment

    by:drichards
    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
    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
    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
     

    Author Comment

    by:richjo100
    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:
    >> 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
    Excellent thank drichards
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

     Java Android Coding Bundle

    Whether you're an Apple user or Android addict, learning to code for the Android platform is an extremely valuable, in-demand skill. It all starts with Java, the language behind the apps and games that make Android the top platform it is today.

    In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
    zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
    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…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    875 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now