Using ActiveX Documents in Internet Applications

Creating ActiveX Documents

In this exercise, you will create an ActiveX document application in Visual Basic.

* To create an ActiveX document

  1. In Visual Basic, start a new ActiveX Document EXE project.

    Visual Basic automatically adds a UserDocument designer to the project. If the designer is not immediately visible, right-click over its default name , UserDocument1, in the Project Explorer window, then click View Object . When the designer appears, its default name is visible in the title bar.

  2. Change the name of Project1 to ActXDoc .
  3. Change the name of UserDocument1 to FirstDoc .
  4. Open the FirstDoc designer and add a command button and a text box.
  5. Set the following properties:
    Object Property Value
    Command button Name CmdNavigateTo
      Caption Navigate To
    Text box Name TxtURL
      Text http://localhost

  6. Add the following code to the cmdNavigateTo_click event:
     ' Use the Hyperlink object method NavigateTo ' to go to the URL in txtURL. Hyperlink.NavigateTo txtURL.Text 
  7. Save the project to the WA\Practice\Ch08 folder. Name the user document FirstDoc.dob and the Project as ActXDoc.vbp . Do not add the project to Visual SourceSafe.
  8. Start the application and leave it running in the background.
  9. Start Internet Explorer and browse to the following local file address:
     c:\Program Files\DevStudio\VB\FirstDoc.vbd 
  10. Click the command button to navigate to the URL specified.

Lesson Summary

ActiveX documents are forms that can appear in ActiveX document containers. They can contain insertable objects, such as Microsoft Excel pivot tables, and they can show message boxes and secondary forms. An ActiveX document differs from a traditional document in that it offers not only the full functionality of an application, but also the ability to store and distribute copies of the data intrinsic to the application.

Hyperlink objects, merge menus , the PropertyBag object, and the ability to automatically download components over the Internet are some of the features you can include in your ActiveX documents.



Microsoft Windows Architecture Training
Microsoft Windows Architecture for Developers Training Kit
ISBN: B00007FY9D
EAN: N/A
Year: 1998
Pages: 324

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