Thread: Microsoft VC++

  1. #1
    Registered User FourAngels's Avatar
    Join Date
    Aug 2015
    Location
    Canada
    Posts
    130

    Microsoft VC++

    I have the VS 2015 and I can write console applications that support C++ 11 and C++ 14. Okay that is great, but lets say that I write a whole program that solves some sort of problem and I want to make a GUI component so that it is presentable to a user. I know that there was a library created before .Net came about called the MFC library, however if I wanted to use .Net instead of MFC can I still use C++ 11/C++14 and the STL with .Net? I think that this part of .Net is called the Microsoft Presentation Foundation (MPF). Can I use that instead of MFC...? or do I have to use MFC if I want the STL?

    If not than I might use C# instead of C++ but C# might not have a comparable STL, or does it?

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Given that the STL are libraries, nothing should be preventing you from using them regardless of the GUI framework you use.

    C# has Array, ArrayList, List<>, Stack, Queue, and Hashtables built-in.

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    MPF is usable by managed languages (C#, C++/CLI (this is not native C++!), etc). All managed languages can interop with native languages (google it).
    C++/CLI can also call C++ directly, so you can marshal data between managed/native via some translation layer written in C++/CLI.
    .NET and MPF are not the same thing. MPF is a specific GUI framework/library available in .NET.
    C# does have a standard library (the .NET framework).

    There are also GUI libraries for C++ (e.g. MFC, Qt).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User FourAngels's Avatar
    Join Date
    Aug 2015
    Location
    Canada
    Posts
    130
    Okay, that is what I thought, there are now very similar features available in C#. I can still read my textbook and learn the newest C++ from Bjarne and than do a translation to C# by substituting very similar language features instead of doing the unsafe code portions that have std::c++ mixed with the framework code (so I can access .Net instead of MFC). I have been away from programming for ten years. When I left it was because I did not want to use Win32 or MFC. Now I did see a book written for the 2013 visual studio where MFC was used with C++, so that is why I wondered why they were not using WPF (the .Net Windows API). The reason is that they had to steal the language and call it by another name. I guess that they are trying to follow the church because a similar thing happened several hundred years ago.

  5. #5
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Quote Originally Posted by FourAngels View Post
    Okay, that is what I thought, there are now very similar features available in C#. I can still read my textbook and learn the newest C++ from Bjarne and than do a translation to C# by substituting very similar language features instead of doing the unsafe code portions that have std::c++ mixed with the framework code (so I can access .Net instead of MFC).
    Well, you probably could, but shouldn't. It is true that if you know C++, learning C# is very simple, but if your goal is to write in C#, learn C#, don't try to learn C++ and then translate. You wouldn't be getting the most out of C#, which while heavily inspired by C++ and Java, is a different language with its own neat features (I absolutely love null coalescing and now the new null conditional operators).
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  6. #6
    Registered User FourAngels's Avatar
    Join Date
    Aug 2015
    Location
    Canada
    Posts
    130
    I forgot that C++ on Windows is just used for the plumbing because the OS was written in an archaic form of C++. If you look at they way that they started to teach C++ about fifteen years ago it relies more on using its own library to the extent that it was renamed, modern C++.

    The work that I am interested in is upgrading the eReader. There is an epub file format that Reader devices use but it does not support any kind of sound functionality. I want the reader to be able to play sound along with being able to follow the Reader text. It would be nice to be able to have fine detailed control over the text which would also support audio features. This obviously is not possible to do because for one thing there is no such thing as an open source Reader, that device does not exist! The epub format is also insufficient.

    Okay, when you look at .Net, the closest thing that I can see out there resembling it is the PlayStation Network (too bad Sony dropped their Reader...or it lost popularity...they could have used it on the PSN). Anyway, Sony did the best job using the middleware software layer. I'm not sure if the QT library is a framework of objects or if it has an intermediate runtime interpreter, etc. This architecture was supposed to allow applications to have easy access to different types of servers. In addition the code is much cleaner because the API hides all of the dirty macros in its private implementation...it has much more visibility and traceability in its ordering of parts.

    It looks like C# might be a perfectly interesting time although I do not trust it because C++ is a rich language...but basically C# is a product of Microsoft and so is .Net. The Open Source people are more to blame than anything, but than they do not have billions of dollars in their pockets and stuff like that. If I can blame Microsoft for anything than it might be that they are allowing access outside of the .Net framework...this should be closed.

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    You are mumbling a lot of things here. The Win32 API interface is written in C, not C++. "Modern" C++ refers to using the C++11 and 14 standard as opposed to C++03. Also, it was never, and probably never will be, renamed to modern C++. That's just a phrase that's used by the community today.

    C# IS a rich language. Stop pretending it is not. Start trusting it. It's a great language. It's also an open standard.

    Just start looking for libraries for either C++ or C#. Can you find anything? If you do, write a quick prototype for both languages. Which is easiest? Pick that one.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Elysia
    "Modern" C++ refers to using the C++11 and 14 standard as opposed to C++03. Also, it was never, and probably never will be, renamed to modern C++. That's just a phrase that's used by the community today.
    Indeed, "modern" means "relating to present and recent time", so the term evolves as C++ evolves and depends on the timeframe of the discussion (e.g., my "modern Japanese history" university module started with the battle of Sekigahara in 1600 as the reference point for "modern"). In a general sense "modern C++" refers to multiparadigm programming using standard C++, so maybe a decade ago it would have referred to C++ written according to C++98 and C++03 and associated techniques and styles, as opposed to pre-standard C++ code and associated techniques and styles. However, once C++11 arrived, newer techniques became standard and hence more accessible, and as the pre-standard styles and techniques disappear, "modern C++" now refers to C++ programming that uses such post-C++11 techniques, libraries, etc, but you may find that existing books (that still contain considerable relevant material) refer to C++03 as "modern", which when considering a longer timeframe it still is.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    However, once C++11 arrived, newer techniques became standard and hence more accessible, and as the pre-standard styles and techniques disappear, "modern C++" now refers to C++ programming that uses such post-C++11 techniques, libraries, etc, but you may find that existing books refer to C++03 as "modern", which when considering a longer timeframe it still is.
    O_o

    You would be nearer correct if not for idioms, libraries, and techniques we've used for over a decade. The nature of "Modern C++" hasn't changed very much in a long time. The face of "Modern C++" has only changed. We spell components with `std::` these days because the standard library is catching up with libraries used for years. We use `auto` and lambdas because the standard language is catching up with how we want to express code. We have "rvalue references" because the standard formalizes idiomatic library solutions. The fact is that old,reliable, and well-understood techniques became standard.

    A few of the ideas we're using now is slated for the C++17 standard. A great many of the ideas we're using now isn't being conscidered for the C++17 standard. A couple of the ideas we're using now is being delayed for a later standard because C++17 is already so large an update.

    The community sets the goal for the standard. The standard, almost by definition, always comes too late for the "Modern C++" benchmark.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  10. #10
    Registered User FourAngels's Avatar
    Join Date
    Aug 2015
    Location
    Canada
    Posts
    130
    There isn't much activity here on the C# forum. How is Java doing these days? It looks like C# is the default language of Visual Studio and I'm sure that it is not difficult to accomplish something quickly with .Net. I don't know if it is simple as pie to work with sound in .Net, I've practiced the violin for the last few years, but what I really want is my Reader to support audio recordings in which I can read along and listen or possibly be able to substitute one voice actor for another.

    ...but lets get a bit more technical for a minute. The C++ plumbing work on Windows is still fine if you are writing a system application, if you want to access ports and sockets, write a device driver, etc. I would not waste my time however creating Windows in MFC or Win32 when the option of using .Net is available.

    Okay someone said that Standard C++ was a multi paradigm language accompanied by a standard library, and I think that the approach is to create objects and sort out the interface and hide the implementation, and when you can improve an interface by adding a generic type or else use the standard library than you should take advantage of the feature. Now as far as needing to have a framework library, apparently this is not a language issue. What I was thinking though is that a framework library is able to support an integrated software solution...servers can be accessed by your application using this same framework library. That is how I understood it...i've never used any of it.

  11. #11
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Quote Originally Posted by FourAngels View Post
    ...but lets get a bit more technical for a minute. The C++ plumbing work on Windows is still fine if you are writing a system application, if you want to access ports and sockets, write a device driver, etc. I would not waste my time however creating Windows in MFC or Win32 when the option of using .Net is available.
    Windows programming doesn't have "C++ plumbing". Essentially you have native code and managed code, and you can use a multitude of languages for either. The only thing on your list that's actually necessary to do in native code are device drivers; all kernel-mode code is unmanaged. The .NET framework (which is managed code) actually has great support for ports and sockets, as well as higher-level methods of communication - for example, it's quite easy to both write and consume SOAP / RESTful web services, and do so in a way that the framework handles the underlying details of the communication, making a web service call no more difficult than a function call.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  12. #12
    Registered User FourAngels's Avatar
    Join Date
    Aug 2015
    Location
    Canada
    Posts
    130
    Hold on a sec, listen to this. Right, you can access servers such as the database or a web service or a web server, all from the .Net framework, but is doing it that way better than not using a framework because here with the framework you have objects communicating with each other sending messages back and forth and following protocols. The language now has to support this object oriented functionality and it also has to sit along side with non native languages like XML. The editor (Visual Studio) is able to fold up pieces of code and hide them, the editor also might have to do many other things....is it too cluttered.
    Last edited by FourAngels; 08-23-2015 at 06:05 PM.

  13. #13
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Is using the framework faster - yes, it's much, much, much faster, and it makes for very clean, uncluttered code. To consume a single web service requires minimal setup, and calling the service can basically be as simple as two lines of code.

    Compare that to what you'd need to do to consume a SOAP-based service without using a framework:

    * Open a socket
    * Build an XML document with your web request
    * Transmit the document
    * Receive the response
    * Parse the response XML

    When you use the framework, all those details happen behind the scenes. You don't need to know or care that a SOAP-based web service is transmitting and receiving XML documents - to you, it's just parameters in a function call.

    Sure, it makes some auto-generated code, but you don't really even need to look at those source files.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  14. #14
    Registered User FourAngels's Avatar
    Join Date
    Aug 2015
    Location
    Canada
    Posts
    130
    Well can you use the c++ stl with WPF or not? I am still confused about that. I am going to have to read a few docs on Visual Studio. I will post questions to the C# forum...maybe even if they are c++ .Net questions? Oh well, I can find out for myself in short order but like I said the default language is C#. Oh well. Now the first thing that I have to do is open a WPF project as my first ever application...see if c++ allows me to.

  15. #15
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Quote Originally Posted by FourAngels View Post
    Well can you use the c++ stl with WPF or not? I am still confused about that. I am going to have to read a few docs on Visual Studio. I will post questions to the C# forum...maybe even if they are c++ .Net questions? Oh well, I can find out for myself in short order but like I said the default language is C#. Oh well. Now the first thing that I have to do is open a WPF project as my first ever application...see if c++ allows me to.
    By "STL" I assume you mean the portions of the C++ Standard Library that were originally modeled after the pre-standardization Standard Template Library?

    To use WPF you need to use C++/CLI - which, yes, includes support for the C++ Standard Library as well as other C++ standard code. C++/CLI is Herb Sutter's brainchild and he certainly is going to keep supporting things like templates (although, with access to the CLI, you also have access to generics, which are similar yet distinct).
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. microsoft's f#
    By major_small in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 06-02-2003, 01:27 PM
  2. Microsoft after me??
    By RoD in forum Tech Board
    Replies: 4
    Last Post: 05-29-2003, 11:05 AM
  3. Microsoft
    By GSLR in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 02-18-2003, 08:52 AM
  4. Sun win over Microsoft
    By face_master in forum A Brief History of Cprogramming.com
    Replies: 30
    Last Post: 01-01-2003, 12:41 PM
  5. Microsoft
    By edwardtisdale in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 02-01-2002, 09:04 AM