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.

MFC Mapping Modes & Drawing Coordinate

MFC View-Port Origin and Window Origin

MFC supports two kinds of coordinate systems. One is Device Coordinate and the other one is Logical Coordinate. In device coordinate, we point out all in terms of pixels. In logical coordinate, we measure each unit in terms of Metric Standard or British Standard. How each unit maps to the logical measure is called the mapping. We can mention the mapping using the Mapping Modes. In MFC, having the knowledge of Drawing Origin is the key to draw in the Client Area the way you want.

In this Example, we will walk through the examples and demo videos, which will help us in learning the Mapping Modes and doing the MFC drawing using the device contexts. We will also try the ViewPort Origin and Window Origin and how to use them while drawing using MFC GDI APIs.

Continue Reading →

MFC MCIWndCreate & Play Video Files

Running-The-AVI-File-Example

In this article, we will see how we play an AVI video file in MFC Application. To play the AVI file, we will use the Media Control Interface (MCI)  function and its API function MCIWndCreate. The Animate control that ships with MFC can play the AVI files, but you will not get any sound when the video is playing. OK. Let us start with this simple and quick example that plays the video file comp.avi. The AVI file that I am packing with this example has no sound information, so replace that with any video file, which has sound information in it. Note, we call the MCIWndCreate API from the MCI interface embedded into the MFC dialog.

Continue Reading →

MFC DialogBar Explained With Example

MFC DialogBar Example

In this example, we will see how to create and use MFC DialogBar Control. The DialogBar acts like a toolbar. Unlike toolbar, a dialog bar can have controls which we can place in it treating it as dialog. One can dock the DialogBar like a toolbar. To better visualize it, we can think of a tool bar with a radio button, a checkbox and a combo box in it. What we just now imagined can be easily achieved through a DialogBar control.

In this example we will design an MFC DialogBar, then we will place that in a Rebar Control so that we can dock it on the Main Frame window of the SDI application.

Continue Reading →