MFC Articles

01) Changing MainFrame Display using CREATESTRUCT

In this article we will create Single Document Interface (SDI) application for a start. Then we will have a look at the CREATESTRUCT structure to modify the style of the displayed window. Read More

02) Writing MainFrameWnd Window position and size to Registry and Restoring it

In this article I will show I can we preserve the application main window in terms of its size and position with respect to the desktop. The structure wind32 structure WINDOWPLACEMENT will hold the information related to the window size and its position. We can fill this structure for a given window by making a call to GetWindowPlacement. The same way we can set the new position and size of the window using the SetWindowPlacement. OK, how do we preserve the window size and position? We should write this structure... Read More

03) Parsing command line using Custom CCommandLineInfo class

We know that functions will sometimes takes parameters and process it. Similarly executable applications also take parameters and switches and it behaves based on the parameters passed to it. In this article we will see how do we pass command line parameters to a MFC Dialog based applications. The approach is same for other applications like single document and multi document applications... Read More

04) Creating and Using Property Pages

Property pages are created just like the way we create dialog boxes. First the pages will be created and then they will be added to the single sheet. We will create a sample application here that make use the property page... Read More

05) Accessing System Menu

In this article, we will add our own command to the system Menu of the dialog box. You can do the same for SDI as well as MDI applications. The system...  Read More

06) Handling Keyboard Events

We know that keyboard and mouse are very basic hardware interface supported by almost all the computer operating system. When the user presses the Keyboard key the device driver for the keyboard processes that input by making use of the interrupts. Windows OS knows about these kinds of hardware actions in the form of a message structure. The hardware fills this structure...  Read More

07) File processing using Win32 and MFC

In this article, we will look at the example of using the CreateFile and OpenFile win32 API functions with a MFC Dialog based application. Win32 is a very rich API that supplies numerous functions and MFC is just a Framework wrapped over those functions to form logical functioning unit. Win32 API library is in native format that means it is in C style (Procedural Approach) whereas...  Read More

08) Display Popup Menu using TrackPopupMenu in MFC

In this article, we are going to create Main menu with four menu items in it. The last menu item is going to open a sub menu. The menu will be displayed when the mouse is right clicked in the client area of the window and at the location of the mouse pointer..  Read More

09) Creating the Owner Draw menu in MFC

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 item. The default windows provided menu has a standard look and feel. We cannot add Red and blue boxes as menu item through the...  Read More

10) Displaying tooltip text for the dialog control dynamically

A tool tip is a flashing window that shows helpful information about the control in which the cursor is resting for sometime. In this article, we will see how can we create a reusable helper class for displaying the tool tip text for the MFC dialog controls. Read More

11) Setting Image Background for MFC Dialogs

In this article we are going to see how do we set the background image for the dialog based application. You can use the same technique specified here for any dialog by handling WM_PAINT message. Read More

12) Creating Round Windows

In this short article I will show how do you create round login window in MFC. Read More

13) Using the ReBar Control to Host Toolbars

The Rebar MFC control acts as the hosting container for the MFC Toolbar controls. Using the rebar control you can float around the toolbar control in a same row and you can easily re-arrange the control. The rebar control is not limited to host only the toolbars, it can host control like EditBox, Combobox etc. Read More

14) How do Use CDialogBar Control 

In this example, we are going to see how do we create and use DialogBars. The dialog bar acts like a toolbar. Unlike toolbar, a dialog bar can have controls than can be placed in a normal dialog. The dialog bar can be docked like a toolbar. To better explain, think of a toolbar with a radio button, a checkbox and a combo box in it. What you just now imagined can be easily achieved through a dialog bar control...  Read More

15) Playing AVI File 

In this article we will see how do we play an AVI video file. To play the AVI file we are going to use the Media Control Interface function (MCI). The Animate control that ships with MFC pack can play the AVI files but you will not get any sound when the video is playing... Read More

16) Drawing Origin versus Window Origin 

This Article helps you in Understanding what is window Origin, View port Origin and hiw do you use the mapping modes in MFC GDI Drawing... Read More

17) User Defined Mapping Mode

This Article shows how do we defines our own mapping mode. Then this article draws the ellipse by specifying the dimensions in terms of centimeter. Read More 

18) Windows HOOK

A Windows Hook intercepts specific type of windows hardware event before it reaches to its destination say target window. The intercepted hardware events are passed to a function and that function can modify the event and even it can discard it. Such a function Read More 


  1. Thank you for your blog. 04) was very useful to me.

  2. Could you please provide some information on the alignment of multiple toolbars in multiple line arrangement and so on..


Leave your comment(s) here.

Like this site? Tell it to your Friend :)