ActiveX Control
ActiveX is a set of
technology from Microsoft that enables us to make the interactive user
interface. ActiveX technology has a set of components or control that can be
embedded into another application & webpage. These controls can be programmed
for getting active responses.
ActiveX control is
controlled using three things –
Classification of ActiveX
controls:
1. Properties:
Properties are the attributes of the control that can be
modified by the container application.
2. Methods:
Methods are the function that can be called by container
application to make these function available to another application, one
interface is used which is known as IDispatch.
3. Events:
Events are the message that can be sent from the control to
the container application.
i.
Stock Events:
Trigger mouse & keyboard events handling.
ii.
Custom Events:
Trigger specific function event handling.
ActiveX
Control Vs Ordinary Windows Controls:
ActiveX Control
|
Ordinary Windows Control
|
It
can be embedded in application.
|
It cannot be embedded in
application.
|
The
important features of ActiveX control are properties & methods.
|
Ordinary windows control can be controlled
by the message handler.
|
ActiveX
controls can be embedded into webpage.
|
It cannot be embedded into
webpage.
|
ActiveX
control can be written using MFC, C#, C++, AIL
|
It can written as simple in win32
application or written in C.
|
It
supports COM & OLE technologies.
|
It do not support any of
both neither COM nor OLE.
|
They
normally created in the .OCX.
|
The ordinary window control gets created in
the .exe file.
|
It
is easy to build some complex application such as window media player,
Internet explorer.
|
Ordinary windows control
can be used for building simple user interface based application.
|
Creating
ActiveX Controls:
ActiveX is set of technology from
Microsoft. It is used to provide better GUI facilities.
Installing
ActiveX Controls:
ActiveX controls can be used when
it is register in windows registry. There is a windows utility “Regsvr32”,
using which the control can be registered.
Steps for installing ActiveX
Control –
(Consider an ActiveX control we
have named “ActiveCDemo.OCX”)
i.
Go to command prompt (cmd), locate
the directory in which the “.OCX” file of your ActiveX control is present.
ii.
Type the command “C:\ActiveXDemo\debug\regsvr32
ActiveXDemo.OCX”
iii.
We will get following message on
hitting Enter key –
ActiveX Control Container
Programming:
ActiveX
control container programming is a way by which how we used preinstalled and
stored ActiveX control.
For
installing the calendar we will apply following steps:
1. Start
VC++ 6.0, select MFC AppWizard (.exe) option, Give the project name and click
ok.
2. Now
select the dialog based radio button and click net button. Accept the default
value and generate application code.
3. Now
install the calendar control on the control toolbox, select the project
menu-> Add to project-> Components and control. Then click insert button
to insert the control.
This control
will be added into control toolbox. This calendar control provides many events
or properties to handle mouse and keyboard events.
Note:
When we
build the project using MFC AppWizard (.exe), it must be ensured that the
support for ActiveX control option is checked. Then the AppWizard do the
following things –
i.
It insert following line in the
InitInstance member function of the application class –
AfxEnableControlContainer();
ii.
It insert the following line in the
“Stdafx.h”file
#include<afxdisp.h>
this side is verry helpful for me thanks alot of its creatr
ReplyDeletethis notes are very usefull.. thanks for the vc++ stuff..
ReplyDelete