COM/MTS Guide |
A COM component built in the Panther editor consists of a DLL file, a Panther service component, and possibly a type library, all having the same name. Once these files are available, the COM component can be deployed on:
Steps for Deployment |
In order to make a COM component available in a Panther application:
Since the DLL for the COM component and the Panther application library containing the service component are typically located in the same directory, create an application directory and copy the following files to this directory:
Create an Application Directory
server.lib
.
When the COM component is instantiated, Panther looks for a service component matching that name in an application library named To specify a different library name or location, create a
Note:
The In order for an application to be able to access all its components (COM components, screens, menus), you must use Three DLLs distributed with Panther must be on the system's Changing the Library Name
server
.lib
. That library must be located in the same directory as the component's DLL.
smvars
.bin
file containing a setting for SMFLIBS with the library names. That smvars
.bin
file must reside in the same directory as the COM component's DLL.
smvars
.bin file for COM components can contain two settings: SMFLIBS
and SMPATH. Other settings are ignored.
Accessing Libraries
SMFLIBS
to open libraries. Threading specifications dictate that if an object opens a library, only that object will be able to use it.
Install the Panther DLLs
PATH
in order for Panther-built components to work:
PrlSmCom.dll
The default location for these DLLs is These DLLs support calls from individual components according to the COM apartment-threading model.
In COM applications, the client application and the COM component reside on the same machine; the COM component must be registered on that machine.
To register the component, use This process will include the path to the DLL in the Windows system registry. When the component is instantiated at runtime, COM will look for the component's DLL in this location.
In DCOM applications, the Panther application and the COM component reside on different machines. Each machine must register the component, but the process for the server machine (where the COM component is located) differs from the client machine (which runs the application and accesses the component).
For the server machine, register the component using For each client machine, register the component using the Once the .PantherInstallDir
\bin
. The installation program places this directory in the system's PATH
.
Register the COM Component
For COM Deployment
regsvr32
.exe
, located in your Panther util
directory. For example, typing the following command in a DOS prompt window registers forecast
.dll
:
regsvr32 forecast
For DCOM Deployment
regsvr32
.exe
(located in your Panther util
directory).
regsvr32 forecast
componentName
.inf
file. Before making the component's .inf
file available to your application clients, check its settings (particularly the machine name), and edit those settings as needed. This is an ASCII file and can be edited with any text editor.
inf
file is ready:
regcli32
.bat
to install the component on the client machine.
regcli32 forecast
inf
file is mounted, run the file's install command (available by right-clicking on the file).
For more information about the settings in the . Changing the settings in In order to use DCOM, it must be installed on the client and server machine and configured using For MTS, the Microsoft Management Console contains options for registering components and creating export files for application clients. The following section details this process.
inf
file, view the default file, PrlServer
.inf
, which is in ASCII format and located in the Panther config
directory.
PrlServer
.inf
affects all COM components generated from Panther. This file must be named PrlServer
.inf.
Configuring DCOM
dcomcfg
. In particular, the check box for Enable Distributed Communication on This Machine must be selected. For more information, check Microsoft's documentation on configuring machines for DCOM.
For MTS Deployment
Registering Components for MTS |
To deploy Panther-built COM components under MTS, you must complete the steps in the previous section, populating the application directory and installing the Panther DLLs, before registering the component.
Components must be installed into a component package. A package is a collection of components that run in the same process. You can create an new package or add components to an existing package.
To view the existing packages, start the Microsoft Management Console and choose the desired server machine. One of the settings for that machine is Packages Installed. One method to use to create a new package is to highlight Packages Installed and choose ActionNewPackage.
Refer to Microsoft's MTS Documentation for more information about creating packages.
To install a component under MTS on a server, use the Microsoft Management Console. This saves the path to the DLL in the Windows system registry.
Figure 5-1 The Microsoft Management Console window for this sample MTS application shows five COM components in the right panel.
The MTS Management Console will lead you through the steps to install a new component or a pre-existing component.
Note: If you import a component that is already registered, you will be unable to view its interfaces through the MTS Management Console. For more information, refer to Microsoft's MTS Documentation.
If you want to implement security features on your component packages, MTS offers two types of security checks: programmatic security, where you call interfaces from within the application, and declarative security, where you assign users, or groups of users, to roles.
A role is the name assigned to a group of users that will access a component package. For example, a human resources application could define roles for Manager and Employee. In the Microsoft Management Console, you assign users to the defined roles.
Panther MTS applications can implement programmatic security using the following functions which call methods of the IObjectContext interface:
Assign Roles for Component Access
The following section of a JPL procedure, taken from a service component's processing for the For more information about implementing security processing, refer to Microsoft's MTS Documentation.
If the COM component is to be accessed from other machines, it must be registered on those machines as well. The MTS Management Console provides facilities for exporting a component package which creates an executable for installing the package on a remote machine.
Highlight the component package and choose ActionExport.
Refer to Microsoft's MTS Documentation for information about exporting a package.
UpdateData
method, checks to see if the caller is in the writers
role before proceeding:
proc UpdateData
vars security, role
role = sm_mts_IsCallerInRole("writers")
... Export the Component to Clients
Using Database Transactions |
MTS includes support for database transactions at the component level. For each component installed under MTS, the component's Transaction properties specify whether the component:
Panther MTS applications can control database transactions by calling the following functions:
Refer to Microsoft's MTS Documentation for additional information about MTS database transactions.