Microsoft Producer for PowerPoint 2003 SDK banner art
PreviousNext

Adding an E-service Using a Learn More Page

The following sample code creates a Web page that adds a new e-service to the user's computer. This page is displayed when the user chooses an e-service from the Microsoft Web site. When the user selects this service in the Publish Wizard, the wizard provides the customized user interface specified in Options.AddWebHost. Be sure to replace any URLs with your server address.

<HTML>
<!-- 
***********************************************
**   This is a simple example of how to add  **
**   an e-service to the Microsoft Producer  **
**   Publish Wizard.                         **
**                                           **
**   The code uses the Producer object model **
**   to create an entry in the user's        **
**   registry that specifies a URL for the   **
**   hosted browser window in the Publish    **
**   Wizard user interface.                  **
***********************************************
-->
  
<BODY>
<SCRIPT language = "JScript">

// Create a global variable to store the Producer application object.
// Initialize as window.external to get access to the object model.
var Application = window.external;

</SCRIPT>

<!-- Create the Web page that is displayed in Producer. -->

Service: Simple Custom WebHost <BR>
<BR>
Thanks for choosing this e-service. <BR>
Please click the following button to add this service <BR>
to the Microsoft Producer Publish Wizard as a <BR>
new Web Server. <BR>

<BR>

<INPUT TYPE = "BUTTON" ID = "addWebHost" NAME = "addWebHost" VALUE = "Click to add this service!" onClick = "AddWebHost();">


<!-- This is the script that executes when the user clicks the button. -->
<SCRIPT language = "JScript">

function AddWebHost(){

/* Add a WebHost using the Options.AddWebHost method. 
   Specify the HTMLBasedUIURL parameter to set the Web page that
   displays when the user selects the new WebHost from the user
   interface. The method returns a WebHost object. */

Application.Options.AddWebHost("Simple Custom WebHost","http://yourserver/HTMLUI.htm", true);

// Tell the user what happened.
alert("Thank you. This service can now be accessed using the Web Server list in the Publish Wizard.");

// Call the function that closes the browser window hosted by Producer.
CloseEServiceWindow();
}

// This is the function that closes the hosted browser window.
function CloseEServiceWindow(){

        // 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();
        }
}

</SCRIPT>
</BODY>
</HTML>

For more information about this sample, see Adding E-services to Producer.

PreviousNext


© 2001-2003 Microsoft Corporation. All rights reserved.