Microsoft Producer for PowerPoint 2003 SDK banner art
PreviousNext

Adding E-services Using the Producer Object Model

You can write an HTML document that uses the Producer object model in order to add information about your service to the Windows registry on the user's computer. This Web page (or series of Web pages) can display in the browser window that appears when the user clicks Learn More in the Publish Wizard. This documentation shall refer to this Web page as the "add service" page. For an e-service, the add service page should accomplish at least the following three objectives:

  1. Introduce the user to the e-service.
  2. Prompt the user to install the e-service.
  3. Use the Producer object model to register the e-service.

You can use virtually any HTML syntax in the add service page that you would use in Internet Explorer. This means you can also include HTML controls such as BUTTON elements, TEXT and TEXTAREA elements, SELECT elements, and CHECKBOX elements. You can navigate to as many Web pages as you like from the add service page, so you can actually create a series of pages that add a new e-service. The add service page can be resized by the user, and it shows both horizontal and vertical scrollbars if the authored page exceeds the size of the hosted browser window. The default size of the client area of the browser is approximately 570 pixels wide by 400 pixels high.

Following are the basic steps to follow to create the add service page:

  1. Write HTML code to identify the e-service. For example:
    <HTML>
    <HEAD></HEAD>
    <BODY>
    <!-- Create the Web page the displays in Producer. -->
    Service: Simple Custom WebHost <BR>
    <BR>
    Thanks for choosing this e-service. <BR>
    Please click the button below to add this service <BR>
    to the <B>Microsoft Producer Publish Wizard</B> as a <BR>
    new <B>Web server</B>. <BR>
    <BR>
    </BODY>
    </HTML>
    
  2. Provide a way for the user to install the service. The following example creates an HTML BUTTON element.
    <INPUT TYPE = "BUTTON" ID = "addWebHost" NAME = "addWebHost" VALUE = "Click to add this service!" onClick = "AddWebHost();">
    
  3. Get an Application object to gain access to the Producer object model.
    var Application = window.external;
    
  4. Write the function that adds your service details to the Windows system registry. For the case of a service that provides an HTML user interface, you only need to specify the name of the service as you want it to appear in the Publish Wizard (this is also used as the name of the associated registry key) and the Uniform Resource Locator (URL) for the Web page that functions as the customized user interface when the user chooses to utilize the service. The following example code is contained in the AddWebHost function that executes when the user clicks the button created in step 2.
    /* Add a WebHost using the Options.AddWebHost method. 
       Be sure to specify the HTMLBasedUIURL parameter to set 
       the Web page that displays when the user selects the new 
       WebHost from the user interface. */
    Application.Options.AddWebHost("Simple Custom WebHost", "http://MyServer/HTMLUI.htm", true);
    

    If you specify an empty string ("") as the second parameter, the Publish Wizard uses the default user interface when the user selects the e-service from the Web server list. For more information, see the section Adding Web Servers Automatically.

    The value true for the third parameter permits the new WebHost key to overwrite any existing key having the same name.

  5. You should let the user know when the process has been completed successfully and how to use the new e-service.
    alert("Thank you. This service can now be accessed using the Web server list in the Publish Wizard.");
    
  6. Close the add service page to allow the user to return to the standard Publish Wizard user interface.
    // Use the Windows.FindByName method to get the index 
    // of the browser window hosted by Producer.
    var nWin = Application.Windows.FindByName("EServiceWindow");
    
    // Retrieve the hosted window object.
    var pWin = Application.Windows.Item(nWin);
    
    // Test whether the hosted window was successfully retrieved.
    if (pWin){
       // Close the window.
       pWin.Close();
    }
    

For the complete sample that accompanies this topic, see Adding an E-service Using a Learn More Page.

PreviousNext


© 2001-2003 Microsoft Corporation. All rights reserved.