PRG 240 - Class #12 Lecture
Submit your Ch. 4 VB Auto Project
Finish Ch. 6 Lecture & Discussion
- Finish Ch6Demo2 example that we worked on at our last class.
- Review Programming Exercise 6.1 on p. 294.
- There may be a True/False, Multiple Choice, or Fill-in-the-Blank quiz on
Ch. 6 at a future class.
Ch. 8 Lecture & Discussion
- Component Object Model (COM)
- A component is a class module that is compiled and stored for reusability.
- A COM component can be written in C++ or Java, as well as VB.
- The interface of a class is the Public properties and methods.
- We will study two types of code components: ActiveX Dll's and ActiveX
Exe's
- a class or a whole application such as Excel or Word could be an ActiveX
code component
- ActiveX Dll
- runs in the memory space of the consumer application; this is called
in-process
- ActiveX Exe
- runs in its own memory space; this is called out-of-process
- Instancing property - specifies how an object can be instanciated
- MultiUse - (default) allows the programmer to create multiple objects
- SingleUse - creates new copy for every object that is created; only
used for Exe's
- See the chart on p. 360 for other possible Instancing property values
- Testing Components (p. 362)
- For ActiveX Dll's (in-process), you must use the Project Group feature
of VB
- For ActiveX Exe's (out-of-process), you must open two instances of VB
where the Exe project is opened with one copy of VB and the client application
is opened in the other.
- Registering components
- Each component is assigned a unique GUID (globally unique indentifier)
which is kept track by the Windows Registry
- You can use VB to register an ActiveX Dll on your computer. To register
a Dll on a different computer, you can use C:\Windows\System\Regsvr32.exe
with the DOS command
REGSVR32 C:\MyProjectFolder\MyComponent.dll
- ActiveX Exe components are automatically registered on a PC on which
they are compiled.
- Create an ActiveX Dll
- Follow the steps on pp. 364-370 to create and test Ch08ActiveX.dll
- Create an ActiveX Exe
- Follow the steps on pp. 372-374 to create and test Ch08ActiveX.exe
- Code is available to copy and paste for:
- Ch08ActiveXExeClient
- Ch08ActiveXExeServer
- (if time) As a class, do Programming Exercise 8.1 on p. 392 by creating
an ActiveX Dll that computes simple annual interest.
- Review Ch. 5 VB Auto Center specs & spend the remaining time working
on that assignment.
Homework Assignment:
- Review any notes and/or activities in the above lecture that were not covered
in class.
- Review Ch. 6 (classes). There may be a True/False, Multiple Choice, or Fill-in-the-Blank
quiz on Ch. 6 at a future class.
- Read Ch. 8 if you haven't already.
- Read Ch. 9.
- Begin Ch. 5 VB Auto Center #1 only on p. 248. That is, make your
Ch. 4 VB Auto Center project work with ADO object code rather than a Data
Environment. This project will be due at our last class.
Copyright © 2001 Curtis Minich. All Rights Reserved.