1 / 31

Obsydian OLE Automation

Ranjit Sahota Chief Architect Obsydian Development. Obsydian OLE Automation. Session Outline. Obsydian OLE Automation Overview Microsoft OLE Automation Overview Obsydian OLE Automation Framework Obsydian OLE Properties and Methods Examples and Demonstrations Obsydian DCOM Support

adler
Télécharger la présentation

Obsydian OLE Automation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ranjit Sahota Chief Architect Obsydian Development Obsydian OLE Automation

  2. Session Outline • Obsydian OLE Automation Overview • Microsoft OLE Automation Overview • Obsydian OLE Automation Framework • Obsydian OLE Properties and Methods • Examples and Demonstrations • Obsydian DCOM Support • Summary, FAQ and Questions Obsydian OLE Automation

  3. Obsydian OLE Automation Overview • Obsydian Functions can be used other application environments such as VB, Office97, C++ • Obsydian Functions can be used with MTS • Functions can seamlessly inter-operate with multiple development environments • Functions can be used simultaneously with OLE and with normal Obsydian applications • Functions can be remoted using DCOM • Microsoft OLE Automation Supported Obsydian OLE Automation

  4. Microsoft OLE Automation Overview OLE Automation Controller Create an Object Get Existing Object Get / Set Properties Invoke Methods OLE Type Library (.TLB) Automation Server Description Object Property and Method Interfaces Help Text for Objects Dispatch Methods OLE Automation Server Expose Object Properties & Methods Manage Object Creation Manage Object Properties Implement Object Methods Obsydian OLE Automation

  5. OLE Automation Objects • An Instance of a Class ( same as COM) • Exposes Properties • Exposes Methods • Exposes Events • Automation Controller Use Objects • Automation Server Implement Objects Obsydian OLE Automation

  6. Excel 97 Object Model Obsydian OLE Automation

  7. OLE Automation Type Libraries • Define Object Properties and Methods • Source Code with ODL Syntax • ODL = Object Description Language • ODL Syntax based on DCE RPC IDL • Compiled as .TLB File • Interfaces and Methods Exposed Obsydian OLE Automation

  8. OLE Automation Servers • Provides Automation Object Services • Manages and Implements Objects • Implements Business or Service Logic • In Process and Out of Process Servers • DCOM and ActiveX Servers Obsydian OLE Automation

  9. OLE Automation Controllers • Clients of OLE Automation Objects • Manipulates and Drives Objects • OLE Automation Client Environments • OLE Automation Support • Visual Basic, VBA and VB Script • Java and Visual C++ • Delphi, Power Builder and Others • Any COM capable environment Obsydian OLE Automation

  10. Obsydian Automation Framework C++ OLE Automation Client Microsoft OLE Automation Obsydian OLE Automation Framework IPC Java OLE Automation Client VBA OLE Automation Client Visual Basic OLE Automation Client COM Component Object Model Obsydian Generated Function Obsydian Generated Function Obsydian Generated Function Architecture Overview Obsydian OLE Automation

  11. Obsydian OLE Automation Features • Obsydian Functions can be called from: • Visual Basic, VBA for Office 97, C/C++, VB Script • Java, Power Builder and other Tools • Provides automatic data type mapping • Obsydian data types <-> OLE data types • No changes required to existing designs • Exposes Simple Generic Programmable Objects • Obsydian Functions can be used by DCOM Obsydian OLE Automation

  12. Obsydian OLE Objects • App Object • Obsydian Application Environment • Manages Run Time System Objects • Corresponds to one OBRUN.EXE Process • Function Object • Obsydian generated function proxy • Wrapper to actual generated function • Call method allows function to be invoked Obsydian OLE Automation

  13. Obsydian Process Model Client Process Server Process OLE Automation Client Obsydian OLE Automation Framework App Object Function Object Function Object Function Object Microsoft OLE Automation Microsoft OLE Automation OBRUN Application Process Obsydian Generated Function Obsydian Generated Function IPC Obsydian Generated Function Obsydian OLE Automation

  14. Obsydian OLE Cardinality Model Client Process Server Processes App Object Function Object Function Object Function Object OLE Automation Client IPC App Object Function Object Function Object Function Object App Object Function Object Function Object Function Object Obsydian OLE Automation

  15. App Properties and Methods • Properties: • enviornmentKey • 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: • 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. Obsydian OLE Automation

  16. Function Properties and Methods • Properties: • fileNME • This name represents the implementation object that is loaded when the Obsydian run time system attempts to call this function. • implementationNME • This name represents the entry point of the DLL. This is normally the same as the fileNME. • Methods: • 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. Obsydian OLE Automation

  17. Obsydian OLE Class Table ObRun and OLE Class Name Table 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. Obsydian OLE Automation

  18. Visual Basic 5.0 Example Microsoft OLE Automation Obsydian OLE Automation Framework IPC AAVF Category Get Sequential AA10F Category Create Instance Obsydian OLE Automation

  19. Visual Basic Code Create Obsydian App and Function Objects: Dim FncFileNme As String Dim 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) Obsydian OLE Automation

  20. Visual Basic Code Define and Populate Parameters: '---------------------------------------------------------------' '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' Obsydian OLE Automation

  21. Visual Basic Code Invoke the Obsydian Function: '---------------------------------------------------------------' '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 Obsydian OLE Automation

  22. Visual Basic Code Use the Dual and Output Parameters: '---------------------------------------------------------------' '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 + 1 Next Obsydian OLE Automation

  23. VBA Office 97 Excel Example Microsoft OLE Automation Obsydian OLE Automation Framework IPC AAVF Category Get Sequential Obsydian OLE Automation

  24. Visual C++ Example Microsoft OLE Automation Obsydian OLE Automation Framework IPC AAVF Category Get Sequential Obsydian OLE Automation

  25. “Live” VBA PowerPoint Demo Microsoft OLE Automation Obsydian OLE Automation Framework IPC AAVF Category Get Sequential Obsydian OLE Automation

  26. Installation and Registration • Install Obsydian Runtime System(s) • Register the Obsydian Runtime Systems() • OB300RC.EXE /Register • OB300RS.EXE /Register • OB300RN.EXE /Register • Updates Windows OLE Registry Database • Install Type Libraries with Visual Basic • OB300RC.TLB, OB300RN.TLB etc. • Online Obsydian OLE Help File • OLE.HLP Obsydian OLE Automation

  27. DCOM Overview Client Machine Server Machine Visual Basic OLE Automation Client Obsydian Generated Function Obsydian OLE Automation Framework Microsoft OLE Automation COM DCOM Services COM DCOM Services Microsoft OLE Automation DCE RPC Obsydian OLE Automation

  28. DCOM Configuration • DCOMCNFG.EXE • Specify Application Locations • Specify Security Attributes • Configure DCOM on Remote System(s) • Install Application on Remote System(s) • Run Client Application as Normal • Client now Creates App Objects Remotely Obsydian OLE Automation

  29. DCOM Configuration Example Obsydian OLE Automation

  30. Obsydian OLE Automation Summary • Functions can participate in MS Component and Object Integration Technologies • Functions can seamlessly inter-operate with multiple development environments • Functions can be used simultaneously with OLE and with normal Obsydian applications. • Functions can be remoted using DCOM • Obsydian applications can be tightly integrated into MS based applications Obsydian OLE Automation

  31. Obsydian 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? Obsydian OLE Automation

More Related