Installing the Software Components

Now, we're ready to move the

Atldept.dll
and
Atlfinder.exe
over to the remote machine that we'll call the server machine. On the 'server' machine, make sure that the network is prepared, including the activation of printer and file sharing, activation of the user level shares, and the enabling of DCOM connections if necessary. Having done this, create a
C:\Test
directory on the 'server' machine and copy the following files into the directory:

Now change directory to

C:\Test
and type in the following:

REGSVR32 ATL.DLL

REGSVR32 ATLDEPT.DLL

ATLFINDER /RegServer

Each of these operations should complete successfully. Now install Object Viewer and start it up. Check under the All Objects list and find ATLFinder1 Class and ATLDept1 class. Double-click each one to ensure that you can create an instance of each class. Release the instances.

Finally, on the 'server' machine, type in

ATLFINDER /Server
. This will start the
Atlfinder.exe
COM server listening for incoming COM requests. DCOM for Windows 95 doesn't support remote server launching. Therefore, all remote servers must be started manually. If you have a Windows NT 4.0 system, however, you'll not need to manually enter the above command.
Atlfinder.exe
will be automatically launched on-demand under Windows NT DCOM.

Now the 'server' machine is completely configured for operations. Go back to the 'client' machine. I assume that this machine has been properly configured as specified above, and that you've logged on with the same user ID as on the 'server' machine. Now, start up Object Viewer and click on the ATLFinder1 Class under All Objects. On the right-hand pane, you'll see a set of tabs. Click on the Implementation tab. Click on Local Server and you should see a path to the

Atlfinder.exe
on your system. Remove this path and leave the edit box empty. This effectively removes the content of the
LocalServer32
key from the registry. Now, we need to tell the 'client' machine that the
ATLFinder1
class is to be instantiated remotely. To do this, click on the Activation tab, click on the Launch As Interactive User and key in the IP address of the 'server' machine.

Now go back to the left-hand pane and click on the ATLFinder1 Class entry to instantiate an object. If this is successful (it may take a little while), you'll see the interfaces listed and you'll have successfully instantiated an object across the network.

Important note: DCOM for Windows 95 is supposed to automatically start a program named

Rpcss.exe
when a connection is made to the object. However, this doesn't always work. If you have problems connecting to the object try running
Rpcss.exe
on the 'server' before you attempt to connect.

To put the entire scenario to work now, open

TestPage.htm
from the last chapter. After a moment the calendar should start and display all the events. Try selecting a cell with events to get the details. Notice the response. Next, try changing months: notice again the significantly slower response. The ActiveX control is now working over the TCP/IP network via DCOM. The exact same interaction is happening across machine boundaries.

The significant note to make here is that we haven't specifically programmed any DCOM server or DCOM client. The binary code hasn't actually changed at all. It's the same in-proc

Atldept.dll
server, the same
Atlfinder.exe
local server, and the same ActiveX control. All we did was some external configuration, and our COM objects started to communicate with each other over the network. This is significant because it shows the fact that:

DCOM is COM

Almost all legacy COM applications (ones designed with no consideration for DCOM) can be configured to work with DCOM. Of course, new 'from-scratch' applications can take specific advantage of the new features available in DCOM by programming directly to it or—more importantly—being designed specifically for it. We'll have a further discussion on these topics in a later section.

The following diagram depicts the interaction between the ActiveX control and the remote DCOM server components.

© 1997 by Wrox Press. All rights reserved.