active x

22
ACTIVE-X CONTROL Guided by, Ms. K. JAYAPRIYA, B. Tech., LECTURER OF MCA, Presented by, A.ARCHUNAN, [MCA963] S.KARTHICK, [MCA969] P.MUTHU KUMAR, [MCA978] A.SENTHIL KUMAR, [MCA999] S.SURESH, [MCA9104]

Upload: karthick-suresh

Post on 09-Dec-2014

567 views

Category:

Education


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Active x

ACTIVE-X CONTROL

Guided by,

Ms. K. JAYAPRIYA, B. Tech., LECTURER OF MCA,

Presented by,

A.ARCHUNAN, [MCA963]S.KARTHICK, [MCA969]P.MUTHU KUMAR, [MCA978]A.SENTHIL KUMAR, [MCA999]S.SURESH, [MCA9104]

Page 2: Active x

PRESENTATION OUTLINE

Introduction Active-x control Vs Ordinary Wnd control Installing Active-x Controls The Calendar Controls Active-x Control Container Programming Create Active-x Control at Runtime

Page 3: Active x

INTRODUCTION

OLE Controls

Used by Application Developers

Written in C++ (ATL Library)

Page 4: Active x

ACTIVE-X CONTROL VS ORDINARY WINDOWS CONTROL

Ordinary Control

Child Window Standard Window Messages CWnd Class Separate DLL

Page 5: Active x

ACTIVE-X CONTROL VS ORDINARY WINDOWS CONTROL

Similarities

Child Window

WM_CREATE handler

Container

Page 6: Active x

WAYS TO WRITE AN ACTIVEX CONTROL

Microsoft Foundation Class (MFC)

Active-X Template Library (ATL)

Base Ctrl Framework

Visual J++ (COM Object only)

Page 7: Active x

PROPERTIES & METHODS

Properties have symbolic names Index value Dialog Data exchange Methods are like functions It does not send WM_Notification Event does not return value Example

Key Down, New Month.

Page 8: Active x

INSTALLING ACTIVEX CONTROL

Choose add to project from the project menu and choose components and controls

Select registered ActiveX controls

Page 9: Active x

INSTALLING ACTIVEX CONTROL

To copy the ActiveX controls DLL \windows\system for Microsoft win95

Register controls in windows registry

Page 10: Active x

THE CALENDAR CONTROLS

Page 11: Active x

THE CALENDAR CONTROLS

Properties Back Color Day,etc..

Methods NextDay Next Week,etc..

Events Keydown Keyup,etc..

Page 12: Active x

ACTIVEX CONTROL CONTAINER PROGRAMMING

Child window

DDX and its Property value

Page 13: Active x

PROPERTY ACCESS

The ActiveX control developer design

Control and choose Properties.

Design-time properties

Page 14: Active x

CLASS WIZARD'S C++ WRAPPER CLASSES FOR ACTIVEX CONTROLS

C++ wrapper class Dynamically create an instance Match with Dispatch ID Set and Get functions

Page 15: Active x

CLASS WIZARD'S C++ WRAPPER CLASSES FOR ACTIVEX CONTROLS

unsigned long CCalendar::GetBackColor(){ unsigned long result; InvokeHelper(DISPID_BACKCOLOR, DISPATCH_PROPERTYGET,

VT_I4, (void*)&result, NULL); return result;}void CCalendar::SetBackColor(unsigned long newValue){ static BYTE parms[] = VTS_I4; InvokeHelper(DISPID_BACKCOLOR, DISPATCH_PROPERTYPUT,

VT_EMPTY, NULL, parms, newValue);}

Page 16: Active x

CLASS WIZARD'S C++ WRAPPER CLASSES FOR ACTIVEX CONTROLS

void CCalendar::NextDay()

{

InvokeHelper(0x16, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);

}

void CCalendar::NextMonth()

{

InvokeHelper(0x17, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);

}

Page 17: Active x

APPWIZARD SUPPORT FOR ACTIVEX CONTROLS

AppWizard inserts the class Initinstance

Class InitInstance member function: AfxEnableControlContainer();

It also inserts the following line in the project's StdAfx.h file:

#include <afxdisp.h>

Page 18: Active x

CLASSWIZARD AND THE CONTAINER DIALOG

Data members functions

Event handler functions

Page 19: Active x

MAPPING ACTIVEX CONTROL EVENTS

Windows messages and command messages

Dialog class contains one or more ActiveX

controls

It works something like a message map.

Page 20: Active x

CREATING ACTIVEX CONTROLS AT RUNTIME

ClassWizard will create the files

Constructed and destroyed

Manually add the necessary event message

handlers

Page 21: Active x

QUERIES?

Page 22: Active x