Three Ways to Find Files

Let’ say we have to implement a function that search a folder to recursively find files having an extension from a given list of extensions. This article shows three possible implementations: one using FindFirstFile and FindNextFile WinAPI functions, one using CFileFind MFC class and one using Filesystem Library. Find files using FindFirstFile and FindNextFile WinAPI … 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 Direct2D for Rendering WIC Bitmap Sources

Once having a WIC (Windows Imaging Component) source, we can render it by using GDI, GDI+ or Direct2D. There are many examples over the internet including MSDN Library that describes how to perform this. This article describes how to use WIC Wrapper Library, which is designed for using WIC without worrying about directly deal with COM interfaces. … Read more

WIC File Open Dialog Using IFileOpenDialog Interface

A previoius article extends CFileDialog MFC class, in order to make a File Open or a File Save dialog that automatically filters files, according to available WIC (Windows Imaging Component) codecs. This article presents how to show a similar File Open dialog using IFileOpenDialog interface. This way, it can be used not only in an … Read more

WIC Wrapper Library – Version 1.1

WIC Wrapper Library v1.1 has the following: new and completed methods for existing wrapper classes in the previous version; new classes: wic::Bitmap and wic::Palette; a new header containg enums, WicWrapEnums.h. Download: Example 2: Using wic::ImagingFactory::CreateBitmapFromHICON and wic::Bitmap The following example is close to the previous one, except that it uses wic::ImagingFactory::CreateBitmapFromHICON to display an icon … Read more

Multiple-View File Explorer

File Explorer (aka Windows Explorer) is a well known and commonly used file manager application, shipped since early Windows 95 operating system. There are also other replacements that can be found over the Internet, however, let’s see how can we make our own file manager, having multiple (tabbed) views. A brief tour of possible ways … Read more

Listing Windows Known Folders

If the target system is Windows Vista, Windows Server 2008 or newer, enumerating known folders (formerly known as special folders) like Desktop, Documents, Program Files, etc is quite easy by calling GetFolderIds method of IKnownFolderManager interface. It gets an array of all registered known folder IDs (KNOWNFOLDERID). Once having a folder ID, we can call IKnownFolderManager::GetFolder … Read more

Get Physical Drive Serial Number – Part 2

The previous article shows how to get manufacturer-provided serial number for a physical drive by calling DeviceIoControl function. Now, let’s see how can it be made by using WMI (Windows Management Instrumentation). Get serial number by using Win32_PhysicalMedia WMI class To get the physical drive serial number by using Win32_PhysicalMedia class, follow these steps: Initialize COM. … Read more

How to enumerate WIC codecs?

As shown in the previous article, Windows Imaging Component (WIC) comes with built-in codecs (for BMP, JPEG, GIF, PNG, TIFF, and HDPhoto image file formats). Additionally, WIC can deal with other image formats for which appropriate codecs are installed in the system. Basically, to list available WIC codecs and eventually get info for each one, … Read more