Adding a Stub Property

At this point, you can build AutoClik but Autodriv won’t be able to load it. In Step 3, you’ll implement a Position property, which exposes the document’s m_pt member variable to a second dispatch interface. In order to load AutoClik from Autodriv to see your Step 2 code at work, you need to add the stub Position property.

To add the Position property

  1. From the View menu, click ClassWizard.

  2. Click the Automation tab.

  3. In the Class name box, select CAutoClickDoc if it is not already selected, and click Add Property.

    The Add Property dialog box appears,

  4. In the External name box, type Position.

  5. In the Type box, select LPDISPATCH.

  6. Under Implementation, click Get/Set methods.

  7. Click OK.

    This returns you to the Automation tab. The new Position property is implemented with stub Get and Set member functions. The Implementation box shows:

    LPDISPATCH GetPosition();
    void SetPosition(LPDISPATCH newValue);
    

    At this point, you would normally click the Edit Code button to implement the Get and Set methods. However, you’ll do that in Step 3 of the tutorial. For now, this stub property makes it possible to run Autodriv and test the code you added in Step 2.

  8. Exit ClassWizard and save your changes to the project files.