Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

C++

Articles on C++ programming language.

File Processing using CreateFile, ReadFile and WriteFile Win32 APIs

Win32 CreateFile Example

In this article, we will look at the example of using the CreateFile, ReadFile, WriteFile and OpenFile win32 API functions with an MFC Dialog based application. Win32 is a very rich API that supplies many functions and MFC is a Framework wrapped over those functions to form a logical working unit. Win32 API library is in a native format that means it is in C style (Procedural Approach) whereas MFC is an OOPS based Framework API. OK, let us start with the sample.

Continue Reading →

MFC Owner Drawn Menu Using WM_DRAWITEM, WM_MEASUREITEM

Menu Item Resource IDS in Sequential Order

When an owner window of the menu item decides how the menu item should look, then the menu item is known as Owner Drawn Menu. The default windows provided menu has a standard look and feel. We cannot add Red and blue-colored boxes as a menu item through the resource editor. In this Example, we will see how can we display only color boxes as a menu item under the color menu. Here, we will learn the need for the WM_DRAWITEM and WM_MEASUREITEM windows messages.

Continue Reading →