Detailed procedures for the DCOM server and client applications using VB (1) Window9x, Winnt Server, and Winnt Workstation platforms can support DCOM. This section describes how to establish a DCOM server-side application, and their precautions. (I am using Western VB6) 1. Establish the following directory: C: / DCOMDEMO C: / DCOMDEMO / Server C: / DCOMDEMO / Server / Setup C: / DCOMDEMO / CLIENT C: / DCOMDEMO / CLIENT / SETUP
Second, build a server-side DCOM application 1. Open a new VB project, in the New Engineering dialog box, select the "ActiveX EXE" engineering type, open the project, set the following properties:
Control Name Property Value ---------------------------------------------- -------------------- Class Module Class1 (Name) Clsdcomdemoserver Instancing 5 - Multiuse
2. Copy the following code to class module CLSDCOMDEMOSERVER:
Option expedition
Public Function ServerTime () 'Return Server Time ServerTime = Time End Function
Public Function AddNumBers (x as integer, y as integer) AS integer 'Calculate two numbers of sum addNumBers = x y end function
Public Function SubtractNumBers (x as integer, y as integer) _ as integer 'calculates two numbers of differences SubtractNumBers = x - y end function
3. In the engineering menu, click "Project1 Properties." Note: If you have changed and saved the project, the project name will not be called "Project1"
4. Click the "General" button to set the following properties:
Project Type: ActiveX
Startup Object: (NONE)
Project Name: Product Name: ProdcomDemoServer
Project Description: DCOM DEMO PROJECT - Server
5. Click the "Make" button to set the following properties:
Auto Increment:
Application Title: ProdcomDemoServer Version
6. Click the "Compile" button to set the following properties:
Compile to P-code:
Other options do not need to be valid.
7. Click the "Component" button to set the following properties:
Start Mode: ActiveX Component Remote Server Files: PROJECT Note: Be sure to select "Remote Server Files" to generate a VBR file. 8. Click OK
9. On the File menu, click Save Project AS. Save as the name as follows:
Directory file type file name extension name ----------------------------- -------------------------- C: / DCOMDEMO / Server Class Module ComdeMDemServer .cls Project Product ProdcomDemoServer .vbp
10. Click the File menu, click Make ProdcomDemoServer.exe.
A dialog box will pop up and save the EXE file to the following directory: C: / DCOMDEMO / Server Directory.