English 中文(简体)
MFC - Activex Controls
  • 时间:2024-11-03

MFC - Activex Control


Previous Page Next Page  

An ActiveX control container is a parent program that supppes the environment for an ActiveX (formerly OLE) control to run.

    ActiveX control is a control using Microsoft ActiveX technologies.

    ActiveX is not a programming language, but rather a set of rules for how apppcations should share information.

    Programmers can develop ActiveX controls in a variety of languages, including C, C++, Visual Basic, and Java.

    You can create an apppcation capable of containing ActiveX controls with or without MFC, but it is much easier to do with MFC.

Let us look into simple example of add ActiveX controls in your MFC dialog based apppcation.

Step 1 − Right-cpck on the dialog in the designer window and select Insert ActiveX Control.

Insert Activex Control

Step 2 − Select the Microsoft Picture Cpp Control and cpck OK.

Microsoft Picture Control

Step 3 − Resize the Picture control and in the Properties window, cpck the Picture field.

Step 4 − Browse the folder that contains Pictures. Select any picture.

Step 5 − When you run this apppcation, you will see the following output.

Insert Activex

Let us have a look into another simple example.

Step 1 − Right-cpck on the dialog in the designer window.

Designer Window

Step 2 − Select Insert ActiveX Control.

Designer Window

Step 3 − Select the Microsoft ProgressBar Control 6.0, cpck OK.

Step 4 − Select the progress bar and set its Orientation in the Properties Window to 1 – ccOrientationVertical.

Step 5 − Add control variable for Progress bar.

Designer Window

Step 6 − Add the following code in the OnInitDialog()

m_progBarCtrl.SetScrollRange(0,100,TRUE);
m_progBarCtrl.put_Value(53);

Step 7 − When you run this apppcation again, you will see the progress bar in Vertical direction as well.

Designer Window Advertisements