Image credit: upload.wikimedia.org
Component Object Model
Component Object Model or COM is the technology of Microsoft Windows family for components to interact with each other to perform some specific task.
A simple example is Administrative tools in your Windows Operating System.
The easiest way to know a component is to take the real life examples.
For example : A personal computer has Monitor, CPU, Mouse, Keyboard, Speakers etc as components.
In other word, if you want to describe a component, then highlight the word “composed of”
Let’s see this in our Windows system:
An Administrative tool is a component of Windows. The Admin tool is composed of the following components:
Microsoft Management Console
Windows System Assessment Tool
Windows Recovery Environment
Resource Monitor etc
In a nutshell:
If we want to see this in broader perspective, then Windows is an object and its components are
Microsoft Management Console,Windows System Assessment Tool,System Restore,Windows Recovery, Environment, Disk Defragmenter, Event Viewer, Resource Monitor
What is COM+ ?
COM+ (Component Services) provides lots of added facilities like :
COM+ Application Pooling
COM+ Application Recycling
COM+ Applications Running as Service Applications
COM+ Compensating Resource Manager
COM+ Just-in-Time Activation
COM+ Low-Memory Activation Gates
COM+ Object Constructor Strings
COM+ Object Pooling
COM+ Queued Components
COM+ Resource Dispenser Service
COM+ Services Without Components
COM+ Shared Property Manager
COM+ SOAP Service
Component Services (COM+) is next generation of COM(Component Object Model) with dozens of more features that lack in our old Component Model. It has made the life of a developer more easier
Best administration, easy deployment, great security, more reliability as well as scalability.
COM+ is language-neutral.This is the best feature that everyone used to look for, when interacting components of different languages.
Now C# component can easily talk to Vb.Net application and vise versa
Creating a Component for MS PowerPoint
* MS Office tools for Visual Studio.
* MS Office PowerPoint
* See the help for developing MS Office Components for Visual Studio.
Step 1: In our Visual Studio IDE , point towards File and then New and then Project.
Step 2: Expand Project Type pane and select Visual C# and then select Office.
Step 3: Select the version of the Office such as 2010 or 2013 if you are developing PowerPoint Component
for the respective versions of MS Office.
Step 4:In the Templates, select the version of PowerPoint addin.
5tep 5 In the Name box, type PowerPointAddin and click OK.Now the project has been created and the ThisAddin editor is available to you to write your code.
Our task is to create create an Object Model to the ThisAddIn class
that adds a new text box to each new slide
Add a new event to the ThisAddIn_Startup event handler as follows:
This code connects the Application_PresentationNewSlide event handler with the PresentationNewSlide event of the PowerPoint application:
The event handler to add a new text box to each new slide is written as follows:
void Application_PresentationNewSlide(PowerPoint.Slide Sld)
PowerPoint.Shape textBox = Sld.Shapes.AddTextbox(
Office.MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 500, 50);
textBox.TextFrame.TextRange.InsertAfter(“My Custom Text.”);
Build the project with F5 button and now your component is ready to use.