Quantcast
Channel: codexpert blog
Browsing all 85 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Custom Draw vs. Owner Draw Controls

While most of Windows developers heard about and eventually used owner-draw controls, fewer know about custom-draw controls. Both types of controls allow customization but they are pretty different. So...

View Article



Image may be NSFW.
Clik here to view.

Color Picker Listview Control

Among other common Windows dialogs we can find Color Dialog Box that allows to pick a color for our purposes. It can simply be created by a call of ChooseColor WinAPI function or, if using MFC, with...

View Article

Dispelling Common C++ Myths: Static Constructors

Someone may be asked at a C++ interview: “What is a static constructor?“. Possible, one interviewer would expect answers like “A static constructor is one called only once” and/or “A static constructor...

View Article

C++11 concurrency: condition variables

In the previous post in this series we have seen the C++11 support for locks and in this post we continue on this topic with condition variables. A condition variable is a synchronization primitive...

View Article

Image may be NSFW.
Clik here to view.

Painting the Dialog Backround

Generally, it’s not necessary to change the dialog’s default background. Besides, if have to display an image in a dialog, it is preferable to do it in a child control (e.g. static picture or custom...

View Article


C++11 concurrency: locks revisited

In a previous post about locks in C++11 I have shown a dummy implementation of a container class that looked like this (simplified): template <typename T> class container { std::recursive_mutex...

View Article

Listing Processes – Part 1: Introduction

Many users know about Task Manager that allows, between others, to quickly list the currently running processes and get info about each one. Some advanced users may also deal with Windows Resource...

View Article

File Open Dialog with Multiple Selection – Part 1: Old Style

One common beginner’s mistake Someone may use the following code to show a File Open dialog: Example 1 CFileDialog dlgOpenFile(TRUE); dlgOpenFile.GetOFN().Flags |= OFN_ALLOWMULTISELECT; if(IDOK ==...

View Article


Image may be NSFW.
Clik here to view.

File Open Dialog with Multiple Selection – Part 2: Vista Style

As told in the previous article, if the Open File dialog has Vista style, it’s not possible to use common dialog box messages like CDM_GETFOLDERPATH and CDM_GETSPEC in order to calculate the necessary...

View Article


Image may be NSFW.
Clik here to view.

File Open Dialog with Multiple Selection – Part 3: Cutting the Dog Tail

First two articles in this series show how to deal with a large number of selected items, by manipulating the OPENFILENAME::lpstrFile buffer, either for old style or Vista-style Open File dialogs....

View Article

Farewell to new and delete

C++11 introduced several smart pointers (residing in the <memory> header): std::shared_ptr: retains shared ownership of an object, that is destroyed when the last shared_ptr that holds a...

View Article

Inherited constructors in C++11

In C++, a function in a derived class with the same name as one (or a set of overloads) in a base class, hides the function (or the overloads) from the base class. Here is an example:struct base { void...

View Article

Image may be NSFW.
Clik here to view.

Tiles-View List Control

Tiles View in Windows Explorer Using Windows Explorer we can notice, aside others, the Tile View mode. Tiles View (Windows Explorer) It looks like icon views but, beside a title (that shows the file...

View Article


Get Physical Drive Serial Number – Part 1

One frequently asked question is “how to (programmatically) get the serial number of a physical drive?” or “how to find my hard disk serial number?“. One first simple attempt may be to call...

View Article

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...

View Article


Image may be NSFW.
Clik here to view.

Fill a List with Large Amount of Data – Part 2

Inserting a large number of items in a listview control, may take a lot of time. A virtual list does not internally keep items information (like text and so on). Instead, it notifies its parent, asking...

View Article

Image may be NSFW.
Clik here to view.

Fill a List with Large Amount of Data – Part 3

The previous article demonstrates how to improve performance by using a virtual listview control (having LVS_OWNERDATA style set) and handling LVN_GETDISPINFO notification. That’s pretty cool! However,...

View Article


Image may be NSFW.
Clik here to view.

Listing Processes – Part 2: Using PSAPI

A previous article shows how to list running processes from command line. Next, we’ll see how to get a list of processes in our own programs. Let’s start by using Process Status API (PSAPI). Using...

View Article

Image may be NSFW.
Clik here to view.

Listing Processes – Part 3: Using Tool Help Library

Tool Help Library makes it easy to enumerate and get info about processes, threads, modules, and heaps. Let’s use it to get a list of running processes. Using Tool Help Library First, take a snapshot...

View Article

Image may be NSFW.
Clik here to view.

Listing Processes – Part 4: Using Remote Desktop Services API

Using Remote Desktop Services API We can call WTSEnumerateProcesses function to get information about the active processes on a specified Remote Desktop Session Host server. However, if pass...

View Article
Browsing all 85 articles
Browse latest View live


Latest Images