Virtual Developer Workshop: Containerized Development with Docker

Environment: VC6 Win2K/NT/98

This out-of-process server can be called remotely by VC and VBScript clients through network. This 200-line full-featured DCOM project was built with pure Win32 API from scratch. The only function in this server is to double an integer.

For those who are not familiar with DCOM, in this sample, the client will call a function located on a remote machine in an exe file.

Steps to build and test the projects:

  1. Open MiniDcom.dsw, which contains MiniDcom.idl, Server.cpp, Client.cpp and Client.vbs.
  2. Build Server.dsp to get Server.exe, which is the DCOM server.
  3. Build Proxy.dsp to get Proxy.dll, which is the DCOM proxy and stub.
  4. Build Client.dsp to get Client.exe, which is the VC client.
  5. Run server.exe to register this component.
  6. Run "regsvr32 proxy.dll" to register the dll.
  7. Run client.exe. The client will call a function, which was implemented in server.exe and will be running in the server.exe's process. Type in the machine name on which the server is located on (in this case, your computer's name). Type in an integer and see the result. Please don't close the client for now.
  8. Run another instance of client.exe and you can see the two clients share the single instance of the server.
  9. Run client.vbs, you can see that this DCOM server can be called by script language.
  10. Close all the three clients and the server should also disapear.
  11. If you want to run the client on a different machine, check the following:
    • "Ping server-machine-name" is fine.
    • Run dcomcnfg.exe on server machine to add the user account that runs the client.exe.
    • Copy proxy.dll to the client machine and register it by regsvr32.exe.


  1. Since the caller and callee are running in different process even different machines, the call has to cross process boundary. This job is done by proxy.dll, which can be generated automatically from the .idl file.
  2. To serve VBScript clients, IDispatch has to be implemented. We get it done through Type Library, which can be created automatically from .idl file.
  3. We register the server and the proxy-stub DLL so that the system can locate them by the CLSID.


Download demo project - 50 Kb
Download source - 8 Kb


  • why miss "server.h"?

    Posted by Wgy on 07/15/2018 09:32am

    why miss "server.h"?

  • Oz_Dingo

    Posted by Oz_Dingo on 12/30/2004 02:08am

    How can I introduce MFC classes in this project ? Is it possible ? Can you tell me how ?

  • How can i automatically create the proxy dll?

    Posted by T.Ephraim on 12/07/2004 02:09pm

    Does anyone knows it? Or do i not really need the proxy.dll ... but how else can i connect from a remote machine to the server. Ciao Ephraim

  • How to use this program by Com+?

    Posted by Legacy on 02/05/2004 08:00am

    Originally posted by: WenZhong He

    I want to use the client and server application in different machines. I don't know how I use this program by Com+, if so, do I need register the proxy.dll in the client machine? and how do I set in the Component Service?
    By the way, if I make a server application(DLL)myself by ATL
    and check the Check box for Allow Merging of Proxy/Stub on the application setting page of ATL, do I need a single proxy.dll in the client machine?
    I use Windows 2000 in the client and server computer.
    Help me!
    Thank you in advance.

  • DCOM connection

    Posted by Legacy on 12/02/2003 08:00am

    Originally posted by: seb.t

    I have some problem with DCOM connection. When, the server PC is OFF for example, my thread is blocked when it try to connect during several minutes.... what could i do?

  • ADD another method

    Posted by Legacy on 08/21/2003 07:00am

    Originally posted by: joseph

    I Add another method to server.exe.
    The interface like below.
    [id(2), helpstring("method Hello")] HRESULT SayHello(BSTR buf, [out, retval] int* retval);

    In client.exe
    How to Transfer char* to BSTR in order to call the method, SayHello(BSTR buf, int* retval);

  • To run Server & Client in different machine, make sure:

    Posted by Legacy on 07/31/2003 07:00am

    Originally posted by: bingle

    author said:"
    11. If you want to run the client on a different machine, check the following:
    "Ping server-machine-name" is fine.
    Run dcomcnfg.exe on server machine to add the user account that runs the client.exe.
    Copy proxy.dll to the client machine and register it by regsvr32.exe.

    following the step, someone said:"When run client on different machine with server, client says 'CoCreateInstanceEx failed.' why?", me too at 1st.

    the reason is we should not just "add the user account that runs the client.exe" using dcomcnfg.exe on the Server, we should check the following too:

    If you logged in using a domain account and both machine Client and machine Server belong to that domain, then you can be authenticated on both machines. However, if you logged onto machine Client using a local account, then machine Server must have an identical local account (same user name and password), otherwise the activation request will fail.

    see here: http://www.codeguru.com/activex/COMSecurity1.html

  • i think that this program is good.. but...

    Posted by Legacy on 05/31/2003 07:00am

    Originally posted by: peios

    i think that this program is good .
    so i will use this my project works.

    one computer is window2000 (client),other is window2000

    but. i am worry about the bug ,i don't know anythings

    Can you tell me a bug....???

  • Server & Client.exe's HELP!

    Posted by Legacy on 05/01/2003 07:00am

    Originally posted by: BulletProof

    Hi all I am BulletProof. I wanted to know how can I make Server.exe in programming? Can you visually program one as in sample same with Client.exe? it would be helpful.

  • It works fine! Even the .vbs.

    Posted by Legacy on 06/21/2002 07:00am

    Originally posted by: dungo

    It works fine! Even the .vbs.

  • Loading, Please Wait ...

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date