Making bitmap images transparent using

Something I needed recently which I’ve wanted to blog. It’s fairly simple, and also documented elsewhere online, but as with most things I do technical blog wise, explanations work better with screenshots.

Example image, “tick.png” with a non-transparent white background:
Continue reading ‘Making bitmap images transparent using’ »

Creating a Tabbed Dialog using the Windows API

An example demonstrating how to create and display a tab common control using WinAPI (Win32) C++ programming.

Much credit needs to go to Ken Fitlike’s excellent WinAPI site, from which I orginally learned how to do stuff like this. I don’t think the site has been updated for a number of years but it contains a ton of useful material on showing you how to create various things using the WinAPI.

All that is required to create a Tabbed Dialog is some small modifications to the Simple Window example: the WndProc function handles WM_CREATE and WM_SIZE messages in addition to WM_DESTROY:

	switch (uMsg)
		case WM_CREATE:
			return OnCreate(hwnd,reinterpret_cast<CREATESTRUCT*>(lParam));
		case WM_DESTROY:
			return 0;
		case WM_SIZE:
			return 0;
			return DefWindowProc(hwnd,uMsg,wParam,lParam);  

Continue reading ‘Creating a Tabbed Dialog using the Windows API’ »

The Model View Presenter pattern in C# – a minimalist implementation

The Model View Presenter (MVP) is a design pattern that is particularly useful for implementing user interfaces in such a way as to decouple the software into separate concerns, such as those intended for data processing and storage (model), business logic, the routing of user commands, etc, thereby making more of your code available for unit testing.

The MVP design pattern separates the following concerns:

The Model. Stores the data to be displayed or acted upon in the user interface.

The View. A passive user interface that displays the model data and routes user-initiated events such as mouse click commands to the presenter to act upon that data.

The Presenter. Acts upon the model and the view. It retrieves data from the model, and displays it in the view.

Continue reading ‘The Model View Presenter pattern in C# – a minimalist implementation’ »

Changing the font size of the ‘Syntaxhighlighter’ plugin

Alex Gorbatchev’s Syntaxhighlighter is a GREAT plugin for posting code samples on your website.

I know because I use it on here.

My only minor gripe was in the default size of the actual font itself – it was too large for my own preference.

Modifying the size is simple, and I’m going to post it here for future reference.
Continue reading ‘Changing the font size of the ‘Syntaxhighlighter’ plugin’ »

Windows programming using MinGW

A short example of how to started with Windows programming in non-Visual Studio environments.

In this example, we use the MinGW (Minimalist GNU for Windows) compiler within the Code::Blocks integrated development environment.

MinGW can be obtained via the following link:

First select File > New > Project… and opt to create a new empty project:
Continue reading ‘Windows programming using MinGW’ »

Creating and avoiding deadlock conditions in C++

A short and to-the-point post illustrating how a deadlock situation can be created in C++, together with a possible strategy for avoiding such a condition.

I’m am using the boost libraries to implement threads and mutexes, but it should be possible to the standard library implementations std::thread, std::mutex etc as well.
Continue reading ‘Creating and avoiding deadlock conditions in C++’ »

Using sc.exe to communicate with Windows Services in Visual C++

SC.exe is commonly used to retrieve and set control information about installed Windows services. Common tasks are to configure, start and stop a service, as well as retrieve the status of a specific service. These tasks can be achieved by executing sc.exe inside a command prompt as a batch (.bat) files that can call combinations of sc.exe commands to automate startup or shutdown of services.
Continue reading ‘Using sc.exe to communicate with Windows Services in Visual C++’ »

Getting started with client-server applications in C++

A demonstration of simple Internet client-server applications in C++ (Linux-based).

The client application tries to connect to the remote server application using the IP address of the remote server (‘localhost’ or and the server port number which defaulted to 1234.

The server application listens to port number 1234 for a connection request. When the server application receives the connection request it sends the text message “Hello!\r\n” to the client.
Continue reading ‘Getting started with client-server applications in C++’ »

Configuring Code::Blocks to use OpenCV in Linux Environments

A quick guide to setting up and installing OpenCV for using in the Code::Blocks integrated development environment in Linux. The version of Linux I am currently using is Ubuntu 14.04. At the time of writing the version of OpenCV for Linux used is 2.4.9. (I had originally tried version 2.4.10 but had problems compiling it with the version of gcc I had (4.8.2), so I reverted to 2.4.9 instead.) Continue reading ‘Configuring Code::Blocks to use OpenCV in Linux Environments’ »