Step 2: Setting Up the Visual C++ Project (Visual C++ Tutorial) [Office 2003 SDK Documentation]

Previous  Step 1: Setting up the SimpleSample document

Use the following steps to set up your SimpleSample smart document project in Microsoft Visual C++ 6.0.

  1. Start Microsoft Visual C++ 6.0.
  2. Create a new Visual C++ project.

    How?

    • On the File menu, click New, and then select the Projects tab.
    • Select ATL COM App Wizard.
    • In the Project Name box, type SimpleSampleCP, and then specify your project path.
    • Click OK.
    • Click Support MFC.
    • Click Finish, and then click OK to create the project.
  3. Create your project files.

    How?

    • On the Insert menu, click New ATL Object. By default, the Simple Object is selected.
    • Click Next.
    • In the Short Name box, type Actions.
    • Click OK.
  4. Implement the ISmartDocument interface.

    How?

    • On the Workspace window in the Class View tab, right-click the CActions class, and then click Implement Interface. You will receive a message.
    • Click OK.
    • In the Browse Type Libraries dialog box, scroll through the Available Type Libraries list, and then select Microsoft Smart Tags 2.0 Type Library.
    • Click OK.
    • In the Implement Interface dialog box, select ISmartDocument from the list of interfaces.
    • Click OK.
  5. Modify the code as necessary in the Actions.h file.

    How?

    • Switch to the File View tab in the Workspace window.

    • Under Header Files, right-click Actions.h, and then click Open.

    • Although all the function stubs are created for you, you need to modify them as follows:

      In each one of the function stubs, remove the brackets ({}) and everything in between, and add a semicolon (;) to the end of each line.

      For example:

      STDMETHOD(SmartDocInitialize)(BSTR ApplicationName, IDispatch * Document, BSTR SolutionPath, BSTR SolutionRegKeyRoot)
          {
      
              return E_NOTIMPL;
      
          }
      

      Should be replaced with:

      STDMETHOD(SmartDocInitialize)(BSTR ApplicationName, IDispatch * Document, BSTR SolutionPath, BSTR SolutionRegKeyRoot);
      

Next  Step 3: Creating the smart document DLL