Mega Code Archive

 
Categories / Delphi / COM
 

COMDCOM Server Cookbook

Title: COM/DCOM Server - Cookbook Question: A Cookbook or step-by-step instructions for building a DCOM server. (Note that this is just a small cookbook - it doesn't describe things in details - it's just a first step into the topic !!) Answer: To build a SERVER do the following: 1. Open a project (with a form) or an ActiveX-Library if you want a DLL. 2. Add a 'Automation Object' (File/New). Name: FIRSTSERVER 3. Add methods with the help of the type-library-editor 4. Save and run To build the CLIENT do the following: 1. Open a Project and save it. 2. Import the SERVER_TLB.PAS via uses for early-binding. 3. Call the server: var srv: IFirstServer; begin srv := CoFirstServer.Create; srv.Method1; srv := nil; end; That's it ! Some hints for the DEPLOYMENT: 1. Server.exe must be registered at the clientPC and the serverPC: Call "TREGSVR SERVER.EXE" in the DOSBOX. 2. Start DCOMCNFG.EXE at the clientPC - Doubleclick the Classname of the server - Choose the machine where the server should be executed. - Have a close look at the security. HINT: for DCOM configuration look at Dan Miser: www.execpc.com/~dmiser/