Category Archives: C++11

How To: Use XAML and DirectX with C++ and create a compelling Windows Store app

One of the great benefits of using C++ to write Windows Store apps is the ability to mix and match various components and create compelling user experiences. There are a variety of apps that use XAML and DirectX together and have built delightful user experiences. For example, there is the FreshPaint app in the Windows Store that allows free form panting using touch or the OneNote app which allows for, as you know, note taking using a stylus (along with keyboard support).

However, if you want to take a look at code and learn from the experts and masters who have built such apps, there are very few options. One such code base is Project Austin which is a sample built by the C++ team to demonstrate using C++ (and CX) along with XAML and DirectX to build a great note taking app. Today’s post, however, is not about Project Austin. It is about a cool sample built by a colleague and C++ enthusiast, Thomas Petchel. Tom built a cool app named Weathr, which he describes as “3D weather app for Windows 8.1 using C++, DirectX, and XAML“. I cannot agree more. This is the best weather app I have seen in a long time and it shows in the user experience. Tom has also made the sources available for anyone to check out and play with. If you are serious about learning how to build such great experiences in your Windows Store apps, please check out the code. And if you make changes to the code, please ensure you contribute back the changes. This ensures that all the folks get the new stuff!!

I can talk about code and design, but I would leave that out for fellow programmers. The app is not on the Store though. So if you want to get the app, you have to build the sources J

Cheers and Happy Holidays!


It’s time to move away from Turbo C++

You might be surprised to hear that a good number of colleges (at least in India) still rely on using the ages old Turbo C++ package to teach aspiring students C++. With a new language standard and great library support, it is now time to bid goodbye to Turbo C++. I answered a few questions about Turbo C++ and Modern C++ in this month’s edition of PCQuest (Thank you Hiren Mehta and other good folks from PCQuest). Attaching the Q&A below.

201306-PC Quest-Sridhar


While Visual Studio 2012 is a great tool for developing Windows apps using C++, there are also similar utilities for other platforms that support the C++11 standard. These include, but are not limited to, GCC, Clang etc. We owe it to aspiring students and should teach and train them on the latest language standard. In case you have not checked out Modern C++, I urge you all to check out the new language and you will be pleasantly surprised at the changes!!




Getting started with C++

How does one get started with C++? Where should an aspiring developer start? What books should they read? These are some questions that do the rounds of many developers who want to dip their toes in the magical world of C++. This post is an attempt to address some of the questions while also trying to provide my own perspective. If you find the links and my suggestions useful, please do let me know. If you do not find them useful, kindly ignore.

C++11 a.k.a Modern C++ is a new language. It feels different from the old C++ (C++98) and places great emphasis on developer productivity enhancing facilities, focus on runtime performance, writing safe, efficient and portable code. Hence it is very, very important to learn the nuances of Modern C++ v/s trying to learn the old C++ and attempt to fit the old in the new.

Here are my recommended books.

  1. C++ Primer by Stanley Lippman The latest edition has been completely re-written for the C++11 standard.
  2. The C++ Programming Language 4th Ed by Bjarne Stroustrup. The 4th edition has been revised and updated for the C++11 standard.
  3. The C++ Standard Library, 2nd Ed by Nicolai Josuttis. The 2nd edition has been revised and updated for the C++11 standard. This book focuses on the Standard Library that is part and parcel of the C++ programming language.

These books are by no means exhaustive but will allow you to start learning C++. One can begin with C++ Primer and then move to the other books to understand and learn about advanced topics.

Having said that, reading in no way substitutes for actual coding practice. Spend as much time as possible writing code. You can start with simple programs that are discussed in the books above and slowly work your way to adding functionality and features to those programs. Or you can also start writing your own programs. Either way, know your tools and write as much code as possible while applying the concepts you learn.

A lot of coding problems have probably been already solved. The technology world is a rich source of learning from one another, provided one learns to ask the right questions in the proper format. Hang out on sites such as,, MSDN forums etc and learn from fellow developers. If you know the answer to a problem, help your fellow colleagues from the industry. Participating in community activities helps you build confidence in your tools, your craftsmanship and ultimately your own abilities. Think of this as an investment for your own good and the benefit of all.

In addition here are a few links you should regularly visit to keep yourself updated with all major events and happenings related to C++.

    The Home Page of Standard C++.
  2. The Home Page of Bjarne Stroustrup, the designer of C++.
  3. Herb Sutter on software, hardware, and concurrency. He has also begun an updated series of Guru of the Week Questions based on C++11 and will be updating his famous Exceptional C++ series of books with C++11.
  4. Scott Meyers is one of the world’s foremost experts on C++ software development. He offers training and consulting services to clients worldwide.

Again, no means exhaustive but good starting points from where you can learn C++. Once you learn the basics of standard C++, you can then move to learning platform specific extensions like C++ /CX and develop cool Windows Store apps!


Purchase Modern C++ and Windows Store apps in India


Wanted to provide a quick update on the availability of my book, “Modern C++ and Windows Store apps”, in India.

Get the eBook in Adobe PDF:

Get the paperback edition:



[Updated with purchase and discount links] Modern C++ and Windows Store Apps – A book about Modern C++ and native technologies

Over the past few months, I have been writing a book on developing apps using C++ and the various native technologies shipping as part of the Windows 8 wave. Some of these technologies include: C++11, C++ /CX, native XAML, the Windows Runtime, C++AMP, Windows Azure Mobile Services etc. I am happy to announce that the Kindle version of “Modern C++ and Windows Store apps” will be available shortly for purchase via the Amazon website. A paperback edition will also be available soon.

For purchasing the paperback edition of the book, please visit this link. You can use the discount code 5C56GCKN to get 20% discount off MRP.

For folks interested in an electronic edition, you can purchase a Kindle edition on Amazon

A quick update: This is just me self-publishing the book thereby bringing the work to its logical conclusion.

For the benefit of everyone, I am listing some of the topics that await anyone who picks up a copy of this book. For the more adventurous amongst us who would rather prefer to play with code, the book samples can be downloaded from the Downloads section of this blog.

The new native API
What is a Windows 8 App?
Quick walkthrough of a Windows 8 App

Hello Modern C++
Move semantics
Welcome to the Component Extensions
The C++ /CX Type System
Asynchronous Programming in C++ /CX
Building a WinRT component using C++ /CX and ISO-C++
Guidance on the use of C++ /CX

Introduction to XAML
Hello World with XAML and C++ /CX
Basic XAML Syntax
Using Panels to Layout UX
Basic XAML Controls
Windows 8 Signature XAML Controls
Handling Events
Markup Extensions
Data Binding
Binding to a Data Model
Building a XAML custom control
Using Animations in XAML Controls

Introduction to XAML + DirectX
Design considerations when using SiS and VSiS
The DrawIt Application – C++, XAML and DirectX

The C++ AMP Library
The ImageEffects application

Playing by the rules of the Windows Runtime
Introduction to the Windows Runtime Library
Hello World XAML App using Windows Runtime Library

Getting Started with Windows Store apps and Windows Azure Mobile Services
Creating a simple Windows Store app with Windows Azure Mobile Services
Supporting Push Notifications using Windows Azure Mobile Services

And more….

I had a lot of fun writing this stuff and learning along the way. I hope there are concepts that you can apply to your work as you build apps for the Windows 8 Store using C++.

Please send feedback on the book contents directly to win8book at sridharpoduri dot com

Title change for my book

Based on technical review feedback, we (Microsoft Press, the reviewers and the author) have mutually agreed to change the title of my upcoming Microsoft Press book from “Programming Windows 8 Apps using Microsoft Visual C++” to “Modern Microsoft Visual C++ and the Windows Runtime”. The major focus of the book is about “Modern C++” not just C++ /CX (the component extensions) but also about C++11 and how you can take advantage of various features of C++11 to develop Windows Store apps.

In addition, the book also shows how C++11 features such as lambdas, the ‘auto’ keyword and shared_ptr’s can be used in conjunction with C++ /CX to develop Windows Store applications.

DirectX is a proven and well tested graphics API and the book contains full fledged samples that showcase how XAML and DirectX can be mixed and mashed together to produce Windows Store applications.

So, the book TOC has been revised to better align with the focus on Modern C++.

1. Introduction to Windows 8 Apps

2. Modern C++ and C++ /CX

3. Programming XAML using C++ /CX

4. C++ /CX, XAML and DirectX – Better together

5. Advanced GPGPU Programming

6. Under the covers

And a bunch of appendix contents on Unit testing C++ apps, tips and tricks etc.

We still remain on schedule for a launch this April.

Many thanks to all the folks who have been waiting for the launch of this book. I hope you will like the book and the content shared within it.


P.S: The various links on O’Reilly, Amazon and other sites will be reflecting the new title shortly.

The power and flexibility of C++ or why you should write C++ apps for Windows 8 and beyond :-)

Last Friday, the C++ team in Redmond released source code for “Project Austin” a skunk works project that is essentially a note taking app. Check out the team’s announcement blog here.

This app is one great example of the power of C++ allowing you to code in a largely ISO-C++ code base and then interface with the Windows Runtime API. The app uses the XAML-DX SwapChainBackgroundPanel type and uses XAML to layer UI elements over the “main Window”. It also uses C++AMP and extensively uses DirectX and all of the native goodness that is present in C++ and Windows 8.

I could go on and on but I would defer you to the blog post above. And yes, all this goodness in graphics, performance, inking etc without the overhead of GC.


Announcement: Book on C++ /Cx and Metro style app development


I am happy to announce an upcoming book on C++ /Cx and Metro style app development. This book is currently in the works and will be published by Microsoft Press. I present a brief list of topics that are covered in the book.

1. Windows Runtime, WRL and writing apps using WRL.

2. C++ /Cx and C++ 11 features.

3. XAML and C++ /Cx (includes discussion on XAML plus DirectX)

4. Incorporating C++ AMP in Metro style apps.

5. Building WinRT components using C++ /Cx

6. Unit Testing support for C++ in VS 2011.

C++ 11 is new; C++ /Cx is new and so is WinRT. I am super excited to work on these technologies and author a book. Stay tuned for more!!


[Updated URL]:Live Streaming of the Developing Windows 8 Metro apps on Channel 9

Live Streaming link at

I will be tuned in for the entire event. I would encourage all C++ developers to watch the event online, if you cannot make it to Redmond. These are exciting times for C++ developers with Windows 8, XAML and Metro style apps.