obsydian ole automation ranjit sahota chief architect obsydian development ranjit sahota chief...

31
Obsydian OLE Obsydian OLE Automation Automation Ranjit Sahota Chief Architect Obsydian Development

Upload: jayson-armstrong

Post on 27-Dec-2015

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

Obsydian OLE Obsydian OLE AutomationAutomation

Obsydian OLE Obsydian OLE AutomationAutomation

Ranjit SahotaChief ArchitectObsydian Development

Ranjit SahotaChief ArchitectObsydian Development

Presentation

Documents

Page 2: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 22©1998 Synon, Inc. ©1998 Synon, Inc.

Session OutlineSession Outline

Obsydian OLE Automation OverviewObsydian OLE Automation Overview Microsoft OLE Automation OverviewMicrosoft OLE Automation Overview Obsydian OLE Automation Framework Obsydian OLE Properties and Methods Examples and Demonstrations Obsydian DCOM Support Summary, FAQ and QuestionsSummary, FAQ and Questions

Obsydian OLE Automation OverviewObsydian OLE Automation Overview Microsoft OLE Automation OverviewMicrosoft OLE Automation Overview Obsydian OLE Automation Framework Obsydian OLE Properties and Methods Examples and Demonstrations Obsydian DCOM Support Summary, FAQ and QuestionsSummary, FAQ and Questions

Page 3: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 33©1998 Synon, Inc. ©1998 Synon, Inc.

Obsydian OLE Automation OverviewObsydian OLE Automation Overview

Obsydian Functions can be used other application Obsydian Functions can be used other application environments such as VB, Office97, C++environments such as VB, Office97, C++

Obsydian Functions can be used with MTSObsydian Functions can be used with MTS Functions can seamlessly inter-operate with Functions can seamlessly inter-operate with

multiple development environmentsmultiple development environments Functions can be used simultaneously with OLE Functions can be used simultaneously with OLE

and with normal Obsydian applicationsand with normal Obsydian applications Functions can be remoted using DCOMFunctions can be remoted using DCOM Microsoft OLE Automation SupportedMicrosoft OLE Automation Supported

Page 4: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 44©1998 Synon, Inc. ©1998 Synon, Inc.

Microsoft OLE Automation OverviewMicrosoft OLE Automation Overview

OLE Automation Controller

Create an Object

Get Existing Object

Get / Set Properties

Invoke Methods

OLE Automation Server

Expose Object Properties & Methods

Manage Object Creation

Manage Object Properties

Implement Object Methods

OLE Type Library (.TLB)

Automation Server Description

Object Property and Method Interfaces

Help Text for Objects

Dispatch Methods

Page 5: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 55©1998 Synon, Inc. ©1998 Synon, Inc.

OLE Automation ObjectsOLE Automation Objects

An Instance of a Class ( same as COM)An Instance of a Class ( same as COM) Exposes PropertiesExposes Properties Exposes MethodsExposes Methods Exposes EventsExposes Events Automation Controller Use ObjectsAutomation Controller Use Objects Automation Server Implement ObjectsAutomation Server Implement Objects

Page 6: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 66©1998 Synon, Inc. ©1998 Synon, Inc.

Excel 97 Object ModelExcel 97 Object Model

Page 7: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 77©1998 Synon, Inc. ©1998 Synon, Inc.

OLE Automation Type LibrariesOLE Automation Type Libraries

Define Object Properties and MethodsDefine Object Properties and Methods Source Code with ODL SyntaxSource Code with ODL Syntax ODL = Object Description LanguageODL = Object Description Language ODL Syntax based on DCE RPC IDLODL Syntax based on DCE RPC IDL Compiled as .TLB File Compiled as .TLB File Interfaces and Methods ExposedInterfaces and Methods Exposed

Page 8: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 88©1998 Synon, Inc. ©1998 Synon, Inc.

OLE Automation ServersOLE Automation Servers

Provides Automation Object ServicesProvides Automation Object Services Manages and Implements ObjectsManages and Implements Objects Implements Business or Service LogicImplements Business or Service Logic In Process and Out of Process ServersIn Process and Out of Process Servers DCOM and ActiveX Servers DCOM and ActiveX Servers

Page 9: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 99©1998 Synon, Inc. ©1998 Synon, Inc.

OLE Automation ControllersOLE Automation Controllers

Clients of OLE Automation ObjectsClients of OLE Automation Objects Manipulates and Drives ObjectsManipulates and Drives Objects OLE Automation Client EnvironmentsOLE Automation Client Environments OLE Automation SupportOLE Automation Support Visual Basic, VBA and VB ScriptVisual Basic, VBA and VB Script Java and Visual C++Java and Visual C++ Delphi, Power Builder and OthersDelphi, Power Builder and Others Any COM capable environmentAny COM capable environment

Page 10: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 1010©1998 Synon, Inc. ©1998 Synon, Inc.

Obsydian Automation Framework

MicrosoftOLE

Automation

ObsydianOLE

Automation Framework

ObsydianGeneratedFunction

C++OLE

AutomationClient

JavaOLE

AutomationClient

VBAOLE

AutomationClient

Visual BasicOLE

AutomationClient

ObsydianGeneratedFunction

ObsydianGeneratedFunction

COMComponent

ObjectModel

Architecture Overview

IPC

Page 11: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 1111©1998 Synon, Inc. ©1998 Synon, Inc.

Obsydian OLE Automation FeaturesObsydian OLE Automation Features Obsydian Functions can be called from:Obsydian Functions can be called from:

• Visual Basic, VBA for Office 97, C/C++, VB ScriptVisual Basic, VBA for Office 97, C/C++, VB Script

• Java, Power Builder and other ToolsJava, Power Builder and other Tools

Provides automatic data type mappingProvides automatic data type mapping

• Obsydian data types <-> OLE data typesObsydian data types <-> OLE data types No changes required to existing designsNo changes required to existing designs Exposes Simple Generic Programmable ObjectsExposes Simple Generic Programmable Objects Obsydian Functions can be used by DCOMObsydian Functions can be used by DCOM

Page 12: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 1212©1998 Synon, Inc. ©1998 Synon, Inc.

Obsydian OLE ObjectsObsydian OLE Objects

App ObjectApp Object

• Obsydian Application EnvironmentObsydian Application Environment

• Manages Run Time System ObjectsManages Run Time System Objects

• Corresponds to one OBRUN.EXE ProcessCorresponds to one OBRUN.EXE Process

Function ObjectFunction Object

• Obsydian generated function proxyObsydian generated function proxy

• Wrapper to actual generated functionWrapper to actual generated function

• Call method allows function to be invokedCall method allows function to be invoked

Page 13: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 1313©1998 Synon, Inc. ©1998 Synon, Inc.

Obsydian Process ModelObsydian Process Model

AppObject

OBRUNApplication

Process

MicrosoftOLE

Automation

ObsydianOLE

Automation Framework

OLEAutomation

Client

ObsydianGeneratedFunction

MicrosoftOLE

Automation

Client Process Server Process

FunctionObjectFunction

ObjectFunctionObject

ObsydianGeneratedFunction

ObsydianGeneratedFunction

IPC

Page 14: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 1414©1998 Synon, Inc. ©1998 Synon, Inc.

Obsydian OLE Cardinality ModelObsydian OLE Cardinality Model

AppObject

OLEAutomation

Client

Client Process Server Processes

FunctionObjectFunction

ObjectFunctionObject

AppObject

FunctionObjectFunction

ObjectFunctionObject

AppObject

FunctionObjectFunction

ObjectFunctionObject

IPC

Page 15: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 1515©1998 Synon, Inc. ©1998 Synon, Inc.

App Properties and Methods

Properties:Properties:• enviornmentKeyenviornmentKey

– This key is used to control the application environment settings for Obsydian. These environment settings are specified in the OBRUN.INI file for (16 and 32Bit clients) or in the System Registry (for 32Bit NT Servers). These settings include ODBC data source configuration and other variables used by the runtime system. This environmentKey property allows you to control which INI file (or registry entry key for NT) should be used to get the environment settings.

Methods:Methods:• Function(fileNME As String,implementationNME As String)Function(fileNME As String,implementationNME As String)

– This method creates and returns an Obsydian OLE Function object. This Function object is used to make the actual function call to the generated function. The fileNME string parameter specifies the function’s external DLL file name.

Page 16: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 1616©1998 Synon, Inc. ©1998 Synon, Inc.

Function Properties and Methods Properties:Properties:

• fileNMEfileNME– This name represents the implementation object that is loaded when the Obsydian run

time system attempts to call this function.

• implementationNMEimplementationNME– This name represents the entry point of the DLL. This is normally the same as the

fileNME.

Methods:Methods:• Call(InParms As Variant, OutParms As Variant)Call(InParms As Variant, OutParms As Variant)

– This method locates, loads and calls an Obsydian generated Function.

– The InParms and OutParms are OLE SafeArray Variant objects that contain the input, dual and output parameters for the function to be called. All of the input and dual parameters for the function should be contained as elements in the InParms array and all of the output parameters should be contained in the OutParms array.

Page 17: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 1717©1998 Synon, Inc. ©1998 Synon, Inc.

Obsydian OLE Class TableObsydian OLE Class Table

ObRun EXE OLE Class Id DescriptionOB300RC ObRunOLE300RC.App Obsydian OLE for 32BitOB300RCD ObRunOLE300RCD.App Obsydian OLE for 32Bit - DebugOB300RS ObRunOLE300RS.App Obsydian OLE for 32Bit NTOB300RSD ObRunOLE300RSD.App Obsydian OLE for 32Bit NT - DebugOB300RN ObRunOLE300RN.App Obsydian OLE for 16Bit WindowsOB300RND ObRunOLE300RND.App Obsydian OLE for 16Bit Windows - Debug

The table above represents the OLE class names and the corresponding OBRUN EXE that is called when an App is created. The class name is used to qualify the App object to create the correct type of Application environment object.

For example, if you use the Class Name “ObRunOLE300RSD.App”, to create the App object, OLE Automation will start up a process that begins with OB300RSD.EXE. This will then create the Application environment designed to call Obsydian generated functions built for Obsydian 32Bit NT Debug execution.

ObRun and OLE Class Name Table

Page 18: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 1818©1998 Synon, Inc. ©1998 Synon, Inc.

Visual Basic 5.0 Example

MicrosoftOLE

Automation

ObsydianOLE

Automation Framework

AAVF

CategoryGet Sequential

AA10F

CategoryCreate Instance

IPC

Page 19: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 1919©1998 Synon, Inc. ©1998 Synon, Inc.

Visual Basic Code

Dim FncFileNme As StringDim FncImplNme As String

'---------------------------------------------------------------''Create the Obsydian application object''---------------------------------------------------------------'Set ObApp = CreateObject("ObRunOLE300RCD.App")

'---------------------------------------------------------------''Create the Obsydian functions that we want to call''Category.Get Sequential''---------------------------------------------------------------'FncFileNme = "AAVF"FncImplNme = "AAVF"

Set Category_GetSequential = ObApp.Function(FncFileNme, FncImplNme)

Create Obsydian App and Function Objects:

Page 20: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 2020©1998 Synon, Inc. ©1998 Synon, Inc.

Visual Basic Code

'---------------------------------------------------------------''Define the Input,Dual and Output Parameter Arrays'---------------------------------------------------------------'Dim InParms(5) As Variant '6 Element Variant Array'Dim OutParms(24) As Variant '25 Element Variant Array'

'---------------------------------------------------------------''Set the input and dual parameters for Category.GetSequential''---------------------------------------------------------------'InParms(0) = "" 'D: Returning Status'InParms(1) = "" 'I: Positioner.Category Code'InParms(2) = "1" 'I: Input.Instance to get'InParms(3) = 500 'I: Input.Instances to filter'InParms(4) = "" 'I: Selections.Category Code'InParms(5) = "" 'I: Selections.Category Name'

Define and Populate Parameters:

Page 21: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 2121©1998 Synon, Inc. ©1998 Synon, Inc.

Visual Basic Code

'---------------------------------------------------------------''Set the input and dual parameters for Category.GetSequential''---------------------------------------------------------------'InParms(0) = "" 'D: Returning Status'InParms(1) = "" 'I: Positioner.Category Code'InParms(2) = "1" 'I: Input.Instance to get'InParms(3) = 500 'I: Input.Instances to filter'InParms(4) = "" 'I: Selections.Category Code'InParms(5) = "" 'I: Selections.Category Name'

'---------------------------------------------------------------''Call Category.GetSequential''---------------------------------------------------------------’

Category_GetSequential.Call InParms, OutParms

Invoke the Obsydian Function:

Page 22: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 2222©1998 Synon, Inc. ©1998 Synon, Inc.

Visual Basic Code

'---------------------------------------------------------------''Read OutParms and Populate the VB Grid Control''---------------------------------------------------------------'nRows = OutParms(24) ' Instances Fetched’

' Add the retrieved records to the grid'For Row = 0 To (nRows - 1) 'Build a grid entry for each column' For Col = 0 To (nCols - 1) ColText = OutParms(Row * nCols + Col) Entry = Entry & Chr(9) & ColText Next Grid1.AddItem Entry, Row + 1Next

Use the Dual and Output Parameters:

Page 23: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 2323©1998 Synon, Inc. ©1998 Synon, Inc.

VBA Office 97 Excel Example

AAVF

CategoryGet Sequential

MicrosoftOLE

Automation

ObsydianOLE

Automation Framework

IPC

Page 24: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 2424©1998 Synon, Inc. ©1998 Synon, Inc.

Visual C++ Example

AAVF

CategoryGet Sequential

MicrosoftOLE

Automation

ObsydianOLE

Automation Framework

IPC

Page 25: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 2525©1998 Synon, Inc. ©1998 Synon, Inc.

““Live” VBA PowerPoint DemoLive” VBA PowerPoint Demo

Code Category

AAVF

CategoryGet Sequential

Refresh

MicrosoftOLE

Automation

ObsydianOLE

Automation Framework

IPC

Page 26: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 2626©1998 Synon, Inc. ©1998 Synon, Inc.

Installation and RegistrationInstallation and Registration

Install Obsydian Runtime System(s)Install Obsydian Runtime System(s) Register the Obsydian Runtime Systems()Register the Obsydian Runtime Systems()

• OB300RC.EXE /RegisterOB300RC.EXE /Register

• OB300RS.EXE /RegisterOB300RS.EXE /Register

• OB300RN.EXE /RegisterOB300RN.EXE /Register Updates Windows OLE Registry DatabaseUpdates Windows OLE Registry Database Install Type Libraries with Visual BasicInstall Type Libraries with Visual Basic

• OB300RC.TLB, OB300RN.TLB etc.OB300RC.TLB, OB300RN.TLB etc. Online Obsydian OLE Help FileOnline Obsydian OLE Help File

• OLE.HLPOLE.HLP

Page 27: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 2727©1998 Synon, Inc. ©1998 Synon, Inc.

DCOM OverviewDCOM Overview

MicrosoftOLE

Automation

ObsydianOLE

Automation Framework

Visual BasicOLE

AutomationClient

ObsydianGeneratedFunction

COMDCOMServices

COMDCOMServices

MicrosoftOLE

Automation

DCE RPC

Client Machine Server Machine

Page 28: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 2828©1998 Synon, Inc. ©1998 Synon, Inc.

DCOM ConfigurationDCOM Configuration

DCOMCNFG.EXEDCOMCNFG.EXE Specify Application LocationsSpecify Application Locations Specify Security AttributesSpecify Security Attributes Configure DCOM on Remote System(s)Configure DCOM on Remote System(s) Install Application on Remote System(s)Install Application on Remote System(s) Run Client Application as NormalRun Client Application as Normal Client now Creates App Objects RemotelyClient now Creates App Objects Remotely

Page 29: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 2929©1998 Synon, Inc. ©1998 Synon, Inc.

DCOM Configuration ExampleDCOM Configuration Example

Page 30: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 3030©1998 Synon, Inc. ©1998 Synon, Inc.

Obsydian OLE Automation SummaryObsydian OLE Automation Summary

Functions can participate in MS Component and Functions can participate in MS Component and Object Integration TechnologiesObject Integration Technologies

Functions can seamlessly inter-operate with Functions can seamlessly inter-operate with multiple development environmentsmultiple development environments

Functions can be used simultaneously with OLE Functions can be used simultaneously with OLE and with normal Obsydian applications.and with normal Obsydian applications.

Functions can be remoted using DCOMFunctions can be remoted using DCOM Obsydian applications can be tightly integrated into Obsydian applications can be tightly integrated into

MS based applicationsMS based applications

Page 31: Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development

April 19, 2023April 19, 2023 Obsydian OLE AutomationObsydian OLE Automation 3131©1998 Synon, Inc. ©1998 Synon, Inc.

Obsydian OLE Automation FAQObsydian OLE Automation FAQ

How do I prepare a function to be used as an OLE Automation Server? How do I set up the parameter interface for the function I want to call? Why do I have to pass parameters in SafeArrays? Why can’t I just pass in each variable or field as structures? How are Obsydian data types mapped between Variants? What is a Type Library and how are they used for OLE Automation? What is a Variant and SafeArrays and how do they work? How do I find out more information about COM and OLE Automation? How do I find out more about using VB and OLE Automation Servers?