Passing a custom object.

collectionServer.zip
  1. Use a wizard to create an ATL project.

    1. In the Microsoft IDE go to File/New/Projects/ATL COM AppWizard.
    2. Choose location. Type the project name "collectionServer".
    3. Accept the defaults.

  2. Add the collection CoClass

    1. In ClassView right click on "collectionServer classes" and choose "New ATL Object".
    2. Choose the "Simple Object". Click "Next".
    3. Time the short name of the class: TheCoCollection. Change Interface name to ISingleObject.

  3. Add a custom object CoClass.

    Repeate the above procedure. Supply the CoClass name TheCoData and the interface name IData.


  4. Populate IData interface with methods

    1. With source files closed right click on IData
    2. Choose "Add Method...".
    3. Supply method name getID.
    4. Supply parameters as "[out,retval] long* theID". Click OK.
    5. Repeat to supply the rest of the data access.

  5. Populate ISingleObject interface with methods

    Act as above. Provide the methods. Move (copy-paste) declaration of IData before uses of IData type in the idl file.


  6. Supply implementations.

    1. Supply member variable's declarations in the h files.
      TheCoCollection.h
      TheCoData.h
    2. Supply function implementations.
      TheCoCollection.cpp
      TheCoData.cpp

  7. The client application.

    See the collectionTest.xls.
    Download on your hard drive and use VBAs Tools/References to check in the server.

Hosted by www.Geocities.ws

1