Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Object Linking and embedding

Object Linking and Embedding (OLE) is a technology developed by Microsoft that allows embedding and linking to documents and other objects. For developers, it brought OLE Control eXtension (OCX), a way to develop and use custom user interface elements. On a technical level, an OLE object is any object that implements the IOleObject interface, possibly along with a wide range of other interfaces, depending on the object's needs.

OLE allows an editing application to export part of a document to another editing application and then import it with additional content. For example, a desktop publishing system might send some text to a word processor or a picture to a bitmap editor using OLE. The main benefit of OLE is to add different kinds of data to a document from different applications, like a text editor and an image editor. This creates a compound document and a master file to which the document references. Changes to data in the master file immediately affects the document that references it. This is called "linking" (instead of "embedding"). Its primary use is for managing compound documents, but it is also used for transferring data between different applications using drag and drop and clipboard operations. The concept of "embedding" is central to the inclusion of multimedia in Web pages, such as video, animation (including Flash animations), and audio files within the hypertext markup language (such as HTML or XHTML) or other structural markup language used (such as XML or SGML). Modern browsers may use different embedding mechanisms than OLE.

Windows API
Windows exposes lots of functionality in the form of Win32 API. Using these API you can perform direct operation in windows, which increases performance of your application. What is an API? API (Application Program Interface) is a set of predefined Windows functions used to control the appearance and behavior of every Windows element (from the outlook of the desktop window to the allocation of memory for a new process). Every user action causes the execution of several or more API function telling Windows what's happened. It is something like the native code of Windows. Other languages just act as a shell to provide an automated and easier way to access APIs. In .NET we can call

Win 32 API using platform Interop Services, which resides at System.Runtime.InteropServices namespace. Whenever you perform any task in window, it gets executed by giving one or more calls to windows API. Say for example when you press a button on the form, windows sends a message to your windows procedure that eventually hidden from the user. The windows API resides in the DLL's like User32.dll, GDI32.dll, Shell32.dll etc in the windows system directory. These basic win32 API's are splits into three different flavors, depending on code resides in them The separation is as follows User32.dll - handles user interface stuff Kernel32.dll - file operations, memory management Gdi32.dll - involved in graphical whatnots

using System; using System.Text; using System.Runtime.InteropServices; namespace Win32Application { /// <author>Shrijeet Nair</author> public class Win32 { [DllImport("User32.dll")] public static extern Int32 FindWindow(String lpClassName,String lpWindowName); [DllImport("User32.dll")] public static extern Int32 SetForegroundWindow(int hWnd); [DllImport("User32.dll")] public static extern Boolean EnumChildWindows(int hWndParent,Delegate lpEnumFunc,int lParam); [DllImport("User32.dll")] public static extern Int32 GetWindowText(int hWnd,StringBuilder s,int nMaxCount); [DllImport("User32.dll")] public static extern Int32 GetWindowTextLength(int hwnd); [DllImport("user32.dll", EntryPoint="GetDesktopWindow")] public static extern int GetDesktopWindow(); } }

COM Component Object Model (COM) is a binary-interface standard for software component. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages. The term COM is often used in the Microsoft software development industry as an umbrella term that encompasses the OLE, OLE Automation, ActiveX, COM+ and DCOM technologies. A coclass (short for component object class) is contained in a DLL or EXE, and contains the code behind one or more interfaces. The coclass is said to implement those interfaces. A COM object is an instance of a coclass in memory. Note that a COM "class" is not the same as a C++ "class", although it is often the case that the implementation of a COM class is a C++ class.

A COM server is a binary (DLL or EXE) that contains on or more coclasses. Registration is the process of creating registry entries that tell Windows where a COM server is located. Unregistration is the opposite - removing those registry entries. A GUID (rhymes with "fluid", stands for globally unique identifier) is a 128-bit number. GUIDs are COM's language-independent way of identifying things. Each interface and coclass has a GUID. Since GUIDs are unique throughout the world, name collisions are avoided (as long as you use the COM API to create them). You will also see the term UUID (which stands for universally unique identifier) at times. UUIDs and GUIDs are, for all practical purposes, the same.

You might also like