Skip to main content

4 posts tagged with "ATL"

View All Tags

ATL Tutorial (DLL or Inproc Server)

· One min read

In this tutorial we will be creating

  1. MathComp which is a DLL or Inproc server and exposes the Add and Sub functions.

  2. An MFC Dialog Based Application which acts like a Client for MathComp

For complete tutorial refer Tutorial

Basics of ActiveX Controls

· 2 min read

Definition: ActiveX controls are COM components which are self-registering and Implements standard interfaces that deal specifically with GUI-based tasks such as rendering, sizing, activation, and property persistence.

An ActiveX control is anything you might see in the Toolbox of Visual studio (i.e. EditBox, combobox e.t.c) we can even use the Activex controls in web pages using

Connectable Object

Connectable Object: is a COM Component or object that defines and uses an outgoing interface.

Sink: A client that implements the outgoing interface of a component is called sink.

Control Container: An application (Dialog or View ) that houses ActiveX control is called the control container. The control container communicates with a ActiveX control via methods and properties of a control.

ActiveX Control Properties: There are two types of properties 1.Stock Properties 2.Custom properties

1.Stock Properties Stack properties are common properties (Caption, foreground and background colors) that most controls expose. The COleControl data members provides stock properties implementation and also provides notification functions for the stock properties.

2.Custom properties Custom properties are the properties which are specific to the control. There are four different ways to implement Custom properties. a. Member variable: b. Member variable with notification function: c. Get/Set methods d. Parameterized (property array)

ActiveX Control Methods There are two types of methods 1.Stock methods 2.Custom methods

1.Stock methods The COleControl provides the stock methods implementation. there are only two stock properties DoClick() - fires an event from the control Refresh() - updates the control appearence

2.Custom methods Custom methods are the methods which are specific to the control.

ActiveX Control Events A member function of an outgoing interface is called an event. An activeX controlcan notify the containerof a state change using events. There are two types of Events 1.Stock Events 2.Custom Events

1.Stock Events The COleControl provides the common stock Events implementation like mouse button clicks and keyboard input.

2.Custom Events Custom Events are the events which are specific to the control.

Basics of ATL

· 2 min read

What you will Learn Here…

  1. Definition of ATL
  2. ATL Features
  3. Basic Definitions of ATL
  4. ATL's Component Class Hierarchy
  5. FAQ

1. Definition of ATL The Active Template Library (ATL) is a set of template-based C++ classes that allows to create small, fast Component Object Model (COM) objects.

2. ATL Features

  1. ATL provides two types of wizards

a. AppWizard: AppWizard creates the initial ATL project. b. Object Wizard: Object Wizard produces code for basic COM components.

  1. Built-in support for basic COM functionality such as IUnknown, class factories, IDispatch (automation), dual interfaces and self-registration.

  2. Inbuilt Support for Microsoft’s Interface Definition Language (IDL) which provides marshaling support for custom Vtable interfaces as well as component self-description through a type library.

  3. Aggregation of objects and Automation support

  4. Support for developing ActiveX controls.

3. Basic Definitions of ATL

  1. Marshaling: Marshaling is the process of transferring function arguments and return values across process and machine boundaries.

  2. The proxy/stub DLL implements standard marshaling for each of the component interfaces.

COM will use the IPC to communicate between client and server.

  • LPC is used when both reside on the same machine.

  • RPC is used in a distributed networked environment

4. ATL's Component Class Hierarchy

ATL never Creates the instance of the CoClass Directly. Instead ATL uses CComObject template class with 'CMathComp' object type as a parameter to create our Object.

CComObject * pMath = new ComObject

CComObjectRootEx - Handles object reference count management. CComCoClass - Provides methods for creating instances of a class and obtaining its properties it has createInstance() method which creates the instance of a COM Object through ClassFactory CComObject - Implements IUnknown for an COM object.

5. FAQ

  1. What is ATL ? check - 1. Definition of ATL

  2. What is MIDL ? check - 2. ATL Features - 3 point

  3. What are the featurs of ATL ? check - 2. ATL Feature

  4. What is Marshiling ? check - 3. Basic Definitions of ATL - 1 point

  5. Explain about ATL's Class Hierarchy? check - 4.ATL's Component Class Hierarchy

Tutorial to create MFC ActiveX Control which can be used in HTML Pages

· One min read

Definition: ActiveX controls are COM components which are self-registering and Implements standard interfaces that deal specifically with GUI-based tasks such as rendering, sizing, activation, and property persistence.

An ActiveX control is anything you might see in the Toolbox of Visual studio (i.e. EditBox, combobox e.t.c) we can even use the Activex controls in web pages using and handling events with Javascript.

For complete tutorial Refer ActiveX Control Tutorial