Codexpert – 2016 Articles Summary

C++ Programming Language Guidelines Support Library Review: span<T> Guidelines Support Library Review: string_span<T> Microsoft Libraries Easy PNG Resource Loading with MFC – Part 1 MFC Static Control Using Direct2D and DirectWrite MFC Static Control Using Direct2D and DirectWrite (updated) MFC Support for DirectWrite – Part 7: A Step to Custom Rendering Getting Direct2D, DirectWrite and … Read more

How to Get Visual C++ Sample Projects (2)

In a previous article I showed how to get Visual C++ sample projects either by using Visual Studio IDE or by downloading from MSDN – Developer Code Samples site. Recently, I found that we can also download an archive containing a very large number of sample projects from GitHub. Pretty cool! Here is the magic … Read more

Visual Studio 2015: How to Step into MFC Framework Code

Let’s say we have installed Visual Studio 2015 and  have started an MFC application in DEBUG mode. Now, attempting to step into an MFC Framework function, e.g. CWinApp::InitInstance, the debugger simply steps over. Having a look into Output window, we may discover a message like this: “…’C:\Windows\System32\mfc140ud.dll’. Cannot find or open the PDB file”. That’s … Read more

Using Lambdas in MFC Applications – Dealing with C++ REST SDK

C++ REST SDK (also known as Casablanca) offers support for HTTP client/server, JSON, URI, asynchronous streams, WebSockets client, oAuth and PPL Tasks. We can get C++ REST SDK from CodePlex  or use the one shipped with Visual Studio 2013. This article gives suggestions of how to set up a Visual C++ project (particularly one that … Read more

Binary literals and digit separators

The C++14 standard provides two new small features to the language: binary literals and digit separators. They are already available in Clang 3.4 and GCC 4.9 and now Visual Studio 2015 RC has implemented them. They may not be something you can’t live without, but sometimes it’s convenient to have them. Let’s have a look. … Read more

Using Lambdas in MFC Applications – Replacing Callback Functions

According to C++11 Standard, stateless lambdas, i.e. having an empty lambda introducer or capture no variables, are implicitly convertible to function pointers. Visual C++ in Visual Studio 2012 and newer, supports this feature. Moreover, in Visual C++ stateless lambdas are convertible to function pointers with arbitrary calling conventions. This is great if have to deal … Read more

Using Lambdas in MFC Applications – Sorting Arrays

Beginning with Visual Studio 2010 which supports lambda expressions introduced by C++11 standard, you can handily sort an MFC array like in the following example: Sorting CStringArray by using a lambda expression // Example #1 // … CStringArray arr; arr.Add(_T(“John”)); arr.Add(_T(“Zorro”)); arr.Add(_T(“Sandy”)); arr.Add(_T(“Jimmy”)); // … bool bAscending = true; // … std::sort( arr.GetData(), // position … Read more

Command Link Button Control

What are Command Links? Among other new controls supported in Windows Vista and newer Windows versions, we can find  Command Link controls, that contain: an icon; a label text; an additional explanatory text. In fact, it is a common Windows button control (of class “Button“) that has BS_COMMANDLINK or BS_DEFCOMMANDLINK type style set. We’ll further show … Read more