Lab 12: Creating STUpload as an ActiveX Document Server

In this lab, you will see how a fully featured MFC application can easily be created as an ActiveX document server. You will see how the functionality of the STUpload application can be made available to allow Internet Explorer users to view STUpload document files deployed on a Web site.

To make the examples clearer, the STUpload projects that you have been working with throughout this book have not been created with ActiveX document server support. The Chapter 12\Partial folder contains a copy of the STUpload project that has been created with ActiveX document server support. The ActiveX document server support, as you recall, is added by selecting the Full-server and the Active document server options in Step 3 of the MFC AppWizard. You should use a copy of this project as a starting point for the exercises in this lab.

  • To view the ActiveX document server classes
    1. Open your copy of the Chapter 12\Partial\STUpload project. If you look at the classes displayed in ClassView, you will see that the ActiveX document server version of the project has some extra classes. The CInPlaceFrame class represents the frame window that encloses the document when it is edited "in place"—that is, when it is edited in a container. The CSTUploadServerItem class provides the server interface to the container.
    2. Double click the CSTUploadDoc item. Look at the class definition and notice that it is derived from the COleServerDoc class.

    You will now modify the IDR_SRVR_INPLACE menu and toolbar to make STUpload menu commands available from the menu of the ActiveX document container.

  • To edit the IDR_SRVR_INPLACE menu
    1. In ResourceView, double-click the IDR_SRVR_INPLACE menu item. Select the Edit submenu and press DEL to delete the menu. Confirm the deletion by clicking OK.
    2. Double-click the IDR_MAINFRAME menu item. On the Window menu, click Tile Horizontally to view both menus together.
    3. Copy the Data submenu from the IDR_MAINFRAME menu to the former location of the Edit submenu on the IDR_SRVR_INPLACE menu. Copy by dragging the menu while holding down the CTRL key.
    4. From the Data submenu on the IDR_SRVR_INPLACE menu, delete the Import menu comand. Close both menu editor windows.

    You delete the Import menu command because the ActiveX document elements of the STUpload application will be used only to view and upload existing documents deployed on a Web server. You will not offer the capability to create new documents over the Web.

  • To edit the IDR_SRVR_INPLACE toolbar
    1. In ResourceView, double-click the IDR_SRVR_INPLACE toolbar item. Remove the Cut, Copy and Paste toolbar buttons by dragging them off the toolbar.
    2. Double-click the IDR_MAINFRAME toolbar item. From the Window menu, select Tile Horizontally to view both toolbars together.
    3. Copy the ID_DATA_UPLOAD and the ID_DATA_QUERYDATABASE toolbar buttons from the IDR_MAINFRAME menu to the IDR_SRVR_INPLACE menu. Copy by holding down the CTRL key while dragging the buttons across. Close both toolbar editor windows.

    Build the STUpload project. Once the build has completed successfully, complete the following steps to test the ActiveX document server functionality of the STUpload application.

  • To create and deploy an STUpload ActiveX document
    1. Press CTRL+F5 to run the STUpload application. Using the Import command on the Data menu, load the Ch12Test.dat file from the Chapter 12\Data folder. Use the Select Fund window to choose a fund to view.
    2. Close the STUpload application, saving the current document as ADTest.stu.
    3. Deploy the ADTest.stu document to the Docs virtual directory that you created for the exercises in this chapter.

  • To test the STUpload ActiveX document server
    1. Open Internet Explorer and enter the following URL into the Address box:
    2.  http://[your computer name]/docs/ADTest.stu

      The ADTest.stu file should display in the browser. If you do not have a Web site set up on your machine, you can simulate this step by dragging the ADTest.stu file icon from Windows Explorer and dropping it onto the browser.

    3. On the Data menu, click the Upload command. Click OK to upload the file to the database.
    4. Once the upload has completed, use the Query Database command on the Data menu to check that the items you uploaded are now on the database.
    5. Close Internet Explorer.


    Microsoft Press - Desktop Applications with Microsoft Visual C++ 6. 0. MCSD Training Kit
    Desktop Applications with Microsoft Visual C++ 6.0 MCSD Training Kit
    ISBN: 0735607958
    EAN: 2147483647
    Year: 1999
    Pages: 95

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net