Visual Basic: An Object Oriented Approach 12 – Creating and using ActiveX objects.

Slides:



Advertisements
Similar presentations
Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Advertisements

Introduction to .NET Framework
Tahir Nawaz Introduction to.NET Framework. .NET – What Is It? Software platform Language neutral In other words:.NET is not a language (Runtime and a.
COM vs. CORBA.
Building Applications using ASP.NET and C# / Session 1 / 1 of 21 Session 1.
BICS546 Client/Server Database Application Development.
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
CS 501: Software Engineering Fall 2000 Lecture 16 System Architecture III Distributed Objects.
INTERNET DATABASE Chapter 9. u Basics of Internet, Web, HTTP, HTML, URLs. u Advantages and disadvantages of Web as a database platform. u Approaches for.
Kashif Jalal CA-240 (072) Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 2 of…
Introduction to Web Application Architectures Web Application Architectures 18 th March 2005 Bogdan L. Vrusias
CSI 101 Elements of Computing Spring 2009 Lecture #2 Development Life Cycle of a Computer Application Monday January 26th, 2009.
SCRIPTING LANGUAGE. The first interactive shells were developed in the 1960s to enable remote operation of the first time-sharing systems, and these,
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
Visual Basic 6.0 Derived from BASIC Developed by Microsoft in 1998 An event driven programming language Associated with a development environment.
Slide 1 of 9 Presenting 24x7 Scheduler The art of computer automation Press PageDown key or click to advance.
How Open is OpenInsight?
Client/Server Architectures
A Free sample background from © 2001 By Default!Slide 1.NET Overview BY: Pinkesh Desai.
Intro to COM What is it and what can it do for me?
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
1 Modular Software/ Component Software 2 Modular Software Code developed in modules. Modules can then be linked together to produce finished product/program.
Lecture Note 3: ASP Syntax.  ASP Syntax  ASP Syntax ASP Code is Browser-Independent. You cannot view the ASP source code by selecting "View source"
Beyond DHTML So far we have seen and used: CGI programs (using Perl ) and SSI on server side Java Script, VB Script, CSS and DOM on client side. For some.
Week 7 Lecture Web Database Development Samuel Conn, Asst. Professor
L6 - March 1, 2006copyright Thomas Pole , all rights reserved 1 Lecture 6: Software Packaging: Dynamically Integrable Components and Text Ch.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Lesley Bross, August 29, 2010 ArcGIS 10 add-in glossary.
CIS 338: Creating ActiveX Controls Dr. Ralph D. Westfall March, 2003.
Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development.
OPC – OLE for PROCESS CONTROL By: Mugdha More. Swagata Bhaumik.
COM vs. CORBA Computer Science at Azusa Pacific University September 19, 2015 Azusa Pacific University, Azusa, CA 91702, Tel: (800) Department.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Nilotpal Bhattacharya Partner Technical Consultant| Microsoft.
Building COM Add-Ins Don Kiely Software Technologist Third Sector Technologies Fairbanks, Alaska
M1G Introduction to Database Development 6. Building Applications.
Threading Models in Visual Basic Language Student Name: Danyu Xu Student ID:98044.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
‘Tirgul’ # 7 Enterprise Development Using Visual Basic 6.0 Autumn 2002 Tirgul #7.
Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie.
Component Object Model
VBScript Microsoft Visual Basic: Scaleable Solutions Visual Basic  Best tool for distributed client/server solutions  Powerful, robust,
DEV325 Deploying Visual Studio.NET Applications Billy Hollis Author / Consultant.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
1 3. Computing System Fundamentals 3.1 Language Translators.
Introduction to COM and ActiveX Controls. What is an object? In the Fayad sense of the word.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Component Technology. Challenges Facing the Software Industry Today’s applications are large & complex – time consuming to develop, difficult and costly.
SE-02 COMPONENTS – WHY? Object-oriented source-level re-use of code requires same source code language. Object-oriented source-level re-use may require.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 14 Database Connectivity and Web Technologies.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
PRIOR TO WEB SERVICES THE OTHER TECHNOLOGIES ARE:.
Everything You Want To Know About Script But Were Afraid To Ask… Mark Carroll Drew Lytle Script Technologies Microsoft Corporation.
Introduction to JavaScript Fort Collins, CO Copyright © XTR Systems, LLC Introduction to JavaScript Programming Instructor: Joseph DiVerdi, Ph.D., MBA.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 14 Database Connectivity and Web Technologies.
JavaScript 101 Introduction to Programming. Topics What is programming? The common elements found in most programming languages Introduction to JavaScript.
Software: Systems and Applications Software. The Importance of Software in Business time 1950today $ Software Hardware High Low.
Text Introduction to.NET Framework. CONFIDENTIAL Agenda .NET Training – Purpose  What is.NET?  Why.NET?  Advantages  Architecture  Components: CLR,
Introduction to ASP.NET development. Background ASP released in 1996 ASP supported for a minimum 10 years from Windows 8 release ASP.Net 1.0 released.
A S P. Outline  The introduction of ASP  Why we choose ASP  How ASP works  Basic syntax rule of ASP  ASP’S object model  Limitations of ASP  Summary.
Active Server Pages v.s. Java Server Pages Presenters: Lan Guo Qunying Fan Pei-Xun Wu Date:
Packaging and Deploying Windows Applications
Programming vs. Packaged
Web Development Using ASP .NET
COMPONENTS – WHY? Object-oriented source-level re-use of code requires same source code language. Object-oriented source-level re-use may require understanding.
Visual Basic CSC
C++/Java/COM Interoperability
Presented By Justas Raslanas
Web Application Development Using PHP
Presentation transcript:

Visual Basic: An Object Oriented Approach 12 – Creating and using ActiveX objects

Component Object Technologies Components are packages of software Composed of one or more classes Can be used to provide service to programs Can be used flexibly a VB component can be used by a C++ program, a web page or an excel spreadsheet Current development trends emphasize the development and use of components More flexible systems Reusability Easier team development

ActiveX ActiveX is Microsoft’s take on components A marketing term, covering several technologies Object Linking and Embedding (OLE) OLE Automation Component Object Model (COM) ActiveX makes it possible to create components that can interact regardless of location, language or type COM is the standard that ActiveX components conform to DCOM (Distributed COM) operates across local and wide area networks

OLE Automation Use statements in a program to control objects within components Components are library files (DLLs) or separate executable files (EXEs) Controlling program can be written in almost any language VB, C++, VBScript, JavaScript, Java, Perl, Python… Execute efficient binaries from inefficient (but easy to use) scripting languages

Use of OLE Automation Typical use is to build a complex Business application from pre- built components e.g an Access database, an Excel calculating engine and a Word reporting engine Quick, simple and easy to maitain

Typical OLE Automation Code Sub CreateCustomerDocument(CustDetails As String) Dim WOLE As Word.Application Set WOLE = CreateObject(“Word.Application”) WOLE.Documents.Add “ATemplate”, 0 WOLE.Selection.Goto wdGotoBookmark, wdGotoAbsolute, _ 1, “Customer” WOLE.Selection.Find.Text = “”.Replacement.Text = “” End With Selection.InsertAfter CustDetails Application.Printout Set WOLE = Nothing End Sub Code uses Word to create a document (e.g. a Customer’s invoice) and print it out.

Where to get information on OLE Auto servers (ActiveX servers) Documentation – e.g. manuals supplied with libraries VB on-line help – for servers provided by Microsoft (e.g. Office applications) Primary source – The Object Browser Built in to VB Provides accurate interface information on any components on the system

VB’s Object Browser

VB’s Object Browser showing a user-defined class

Creating an ActiveX server Almost trivial in VB VB creates COM components without need for extra code (unlike VC++) Only changes required are type of project selected, and a few (very few) property settings Instancing – component’s strategy for creating objects from its classes ActiveX type In-process (Dynamic Link Library – DLL) Out-of-process (Executable – EXE)

Instancing States how objects can be created for use by the client application Private: only creatable by another class in the same component (Server) PublicNotCreatable: component creates objects for client application SingleUse: only one object of class allowed – client creates it Global SingleUse: as above, but no need to create object reference MultiUse: possible to create many objects from the component – many clients can create them GlobalMulitUse: can be used by many clients

Use of Instancing Property Allows memory and processor allocations to be optimised depending on the type of component e.g. no point in a MultiUse Printing component if there is only one printer that can be used by one client at a time e.g. Many applications could make use of several Invoice objects simultaneously – MultiUse obviously Careful design consideration at the stage of deciding on instancing setting can greatly improve application efficiency

Process allocation Server can be in-process or out-of-process In-process uses the client application’s memory allocation Client finds it inherently easier to work with because it is inside its own memory space Faster Limited to one client per instance of the component Out-of-process runs in its own memory allocation Clients need to communicate with it using operating system resources Slower and more resource hungry Several clients can make use of the same server Server can execute in its own right (without a cllient) E.g. Word, Excel, Access etc.

Building an ActiveX project Before use, server component must be compiled It will be executed by another program out-with Visual Basic This can complicate debugging, since client is required to make component work Can crate VB Project groups (for in-process components) Can run multiple instances of VB (for out-of- process components) Can use the Immediate Window (to do limited test and debug)

Deploying an ActiveX Component Must be registered on the system it will be used on VB does this automatically on the system it was developed on To move the component to another system, must register it explicitly Use RegSvr32.exe, or… Build a setup program using the Packaging and Deployment Wizard – registers component automatically Old components can clutter up a system Use RegServer32 /unregserver to remove registration

Version Compatibility Once a component is registered Windows maintains its registry entry Can not replace it with an incompatible version VB allows three forms of compatibility setting None – Windows does not check for compatibility Project – for use while a project is under development Changes to component interfaces will result in registration information being updated accordingly to allow compatibility between components and clients Binary – for use in deployed components changes made to the interface of one or more classes will result in VB updating the registry information to ensure that incompatible client programs do not try to interoperate with the component

Creating a Server Start an ActiveX EXE or DLL Project Implement server classes as required Set appropriate instancing for each class Create suitable public methods and properties for communication with client Compile project to target form (EXE or DLL) For an ActiveX EXE, run it once on the target computer For an ActiveX DLL, use Package and Deployment Wizard, or execute RegSvr32.exe… RegSvr32 c:\MyComponents\NewComponent.dll

Using a Server in a VB Program Register the server with the program using Project/References menu and checking on the server component Create an instance of the component and use it’s methods