Developing Windows Applications in C++ (Articles Series)

Developing Windows Applications in C++ (Articles Series)

  • Comments 24

Kate GregoryWe got just published “Developing Windows Applications in C++”,  an article series created by C++ Most Valuable Professional Kate Gregory. This material is aimed at C++ developers who want to learn how to write Windows applications. It won’t teach you C++, or how to use Windows as an end user. But if you know C++ and Windows already, and want to write applications, this is the right spot. It’s divided into 6 chapters.

 

  1. The tools you need
    In this chapter you will learn about the Windows SDK and how to get it. Visual Studio will be introduced and the different versions explained. All the demos and samples in this material were developed using Visual Studio 2010 Express, which is available at no charge.
  2. Windows basics
    Here you will see how Windows works under the hood. You’ll meet words like “message” and “handle” that are everywhere for Windows programmers. Windows terminology can be different from what you’re used to, so this chapter clarifies a lot of it. You’ll also see the various ways that Windows interacts with your application and provides functionality for you.
  3. A simple Windows application
    In this chapter, you’ll meet the simplest-possible Windows application and understand its structure, and how it works. These concepts will recur in every Windows application you write. You’ll also see the starter application that is generated by Visual Studio, and how it differs from the simplest-possible application.
  4. Typical Windows tasks
    This chapter starts by transforming the starter application from chapter 3 from a C-style collection of functions into a more object-oriented C++ application. Then it uses Direct2D to paint a simple UI. The sample is further refined by adding reactions to mouse and keyboard events, and then a control is added. You can also see how to show a message box to your users. This gives you all the building blocks for a user interface.
  5. Working with COM
    A lot of Windows functionality is provided through COM, the Component Object Model. This chapter focuses on consuming functionality offered by Windows through COM. It covers COM concepts, demonstrates calling the Text-to-Speech capabilities of Windows through COM, and explains many of the coding patterns and conventions you will see in almost every application that uses COM.
  6. Taking the next steps
    This chapter calls out nine other Windows-related technologies that might interest you, and provides links to starting points you can use to explore those. With the foundation provided by the first six chapters, you can start to incorporate many other technologies into your own Windows applications.
  • It surprises me that Microsoft does not seem to move away from its legacy Windows API model. MFC definitely shows its age, ATL is too complicated for average C++ programmers. I have used all three APIs and have to say they are very poorly designed APIs/libraries/frameworks from an Application Programmers point view. Granted MS has some smart guys that could twist the C++ object model to do some amazing stuff on its platform, but they have not paid much attention to the Developer community.  A while back I started dabbling with Cocoa on iPhone and OSx and was amazed at its elegant (not perfect) libraries and MVC framework. Those guys know how to get an API right for an Application Programmer. I hate Objective C++ but have to say they did a good job from a Developer's perspective. Event Qt seems to be well thought out than MFC. Why doesn't Microsoft spend some resources to develop a good C++ API for windows applications leveraging the new features in C++? It is a tall order but you guys have some of the smartest C++ programmers in the world. Besides most of your core products are built on C++ anyway. Consider this a plea more than criticism.

  • @Krishna, the libraries that are being developed recently follow "modern" approach. Most of them are templatized they have the ability to take lamba expressions as arguments, etc. Parallel Patterns Library is a good example of that.

  • Thanks for the feedback, Krishna. We'll soon disclose details about our plans for future version of the Windows platform. As per Windows 7, without invalidating your comment, this is the current programming model. I can't be more specific right here but we have been disclosing some new features like the upcoming C++ AMP (certainly part of our future releases but also proposed as a standard beyond our platform). While AMP just tackle the problem of heterogeneous parallelism (CPU, GPU, etc.) and doesn't fulfill a complete UI framework, I hope that -together with a few more announcements we made these last months- still gives you an idea that we are investing in making our native development story more and more compelling. Stay tuned.

  • @Diegum:

    Now that's a "I really really wish I could tell you about [X]" kind of comment, if I ever heard one. ;)

  • @Kate Is it just my impression that with upcoming Windows 8 and WinRT the technology you're talking about is out dated and doomed to be maybe not abandoned but less and less in use? And if so wouldn't be better to rather write something about this new technology rather than writing about something which is old and there are tens if not hundreds of books/articles already written on a subject?

  • As far as I know, she's not working on the VC++ team, or for Microsoft at all. So yes, I'm sure it'd be better if she wrote about next year's technology, but I don't really see how she could possibly do that.

  • @Diegum:

    "We'll soon disclose details about our plans for future version of the Windows platform."

    I presume you are talking about the BUILD conference, right? If so, perhaps you can help me out.

    BUILD was announced as far back as June 1, but to this date I still can't figure out what it is going to be about exactly and, consequently, whether I should attend or not. I understand that the conference might be about the cutting edge, but do you at least have a list of sessions or, heck, a list of vague topics for sessions? Even something as generic as 'rich UI' or 'databases' or 'graphics' or 'standards' would help a lot. Is there such a list? I sure can not find anything like that.

    The conference site is of no help:

    http://www.buildwindows.com/

    The blogs where the conference was announced are of no help either.

    Could you help?

    Thanks in advance.

  • @jalf the point I was making is: "What's the point (pun not intended) in writing about something that had been described extensively by others, hundreds of times already". I personally can't see one.

  • @Jalf continue, especially that technology she is talking about is more less "legacy" technology and new one is coming.

  • I do think Microsoft made a bad mistake by leaving MFC and the Resource Editor out of the Express versions

    Let's revist this topic in 6 weeks.  

    p.s. Krishna K, you might want to read both pages of

    arstechnica.com/.../windows-8-for-software-developers-the-longhorn-dream-reborn.ars

  • Well, first of all, "the point", I guess, is just to help people. In the same way that I must have answered certain questions *dozens* of times on StackOverflow. Even though the answers have been described extensively by me and by others hundreds of times already.

    As long as there are newcomers to the technology, there's a need for people to explain it. And if Kate thinks she can explain it better than others, where's the point in *not* trying to do so?

    Second, she doesn't need to justify her actions to you, or to anyone else. She wrote this as a help to the C++/Win32 community, and whether or not it's useful to you, it certainly doesn't harm anyone, and as such, she can write it if she wants to.

    Third, it's not "legacy" technology. True, there are (some very interesting) rumors of something new surfacing at this Build conference. But you and I don't know exactly what that is, and we don't know if it will entirely displace Win32. And even if it does, it very likely won't be supported on older versions of Windows.

    So, if I may summarize your point, you are *angry* that a person *not employed by Microsoft* spent her own time helping others work with a Microsoft technology because Microsoft *might* be working on a successor, and that successor *might* replace said technology completely?

    Really? I find it harder and harder to take you seriously. And I*m really glad I'm not on the VC++ team, because that would mean I had to pretend to take you seriously. I don't. I can't.

  • msdn.microsoft.com/.../hh313028.aspx

    Paragraph "A Collection of Points"

    for (std::vector<std::pair<float,float> >::iterator i= points.begin(); i<points.end();i++)

    I think the above code could be fixed like this:

    1. use a const_iterator

    1a. use C++0x "auto" (available in VC10) instead of the explicit (const_)iterator bloat

    2. compare against end() using != (not <)

    3. pre-increment (instead of post-increment)

    i.e. :

    for (auto i = points.begin(); i != points.end(); ++i)

    or just use for_each, which increases the semantic level of the code...

  • @jalf and what is so <your comment here> in what I've said? I tell you what I've said: I do not see a point in producing more and more materials on subjects described hundreds (if not thousands really) times.

    As for you not taking me seriously? Sure, feel free to do so, but could you please tell me this time what did I do or say anywhere really that makes you think that I shouldn't be taken seriously?

    I'm not saying that you have to agree with everything with what I've said or what my opinions are on certain subject, I'm ok with that and I respect that, but give me the satisfaction and point me to a place in any of my comments on Connect that would suggest that I'm a person who may be not taken seriously.

    Looking forward to your reply.

    P.S. And I really believe that writing hundredth time about some "legacy" technology is pointless.

  • @jalf but you know what, doesn't matter what I think, lets ask people on StackOverflow:

    stackoverflow.com/.../win32-api-is-it-worth-to-learn-it

  • The thing with WinRT is that Windows 8 will have it, 7 and Vista will supposedly get it via service packs. This probably creates a similar situation like in the early days of .NET when developers didn't want to use it because the majority of users didn't have it installed - unless WinRT doesn't replace WinAPI but rather wraps it and you can somehow statically link it.

Page 1 of 2 (24 items) 12