Web Q&A;: Web Page Design Tips, Digital Dashboa...

We were unable to locate this content in de-de.

Here is the same content in en-us.

This article may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. To maintain the flow of the article, we've left these URLs in the text, but disabled the links.
MIND
Web Page Design Tips, Digital Dashboard, Screen Scraper Alternatives, and More
Robert Hess

Q Is the frame and table of contents combination used on MSDN™ Online (http://msdn.microsoft.com) a treeview control, a Java-language applet, or Dynamic HTML (DHTML)? Is the source code available somewhere for download, complete with icons, so I can use it for my own pages?

A What looks like a tree control on the MSDN site is built on the fly with DHTML when you come to the site using Microsoft® Internet Explorer. Microsoft hasn't specifically documented or provided a sample code version of this to make it easy to implement this same functionality on your own site, but since it's comprised of DHTML, HTML, and scripting code, all you have to do is take a look at the source and figure out what it's doing.
      Since Netscape Navigator doesn't implement DHTML in the same fashion as Internet Explorer, you can't use this code for Navigator. You have to use either a Java-language applet or progressive page updates like Netscape does on their own developer site (http://developer.netscape.com).

Q I'd like to embed AVI/ASF files seamlessly into a Web page, possibly by hiding Windows Media™ Player in the page. Where can I find a good working example of this?

A It's easy to use the Windows Media Player on your page with a minimal exposure of its built-in controls. Simply embed the control in your page using the <object> tag.
      By default, in addition to the video playback frame, you will also see the built-in controls for play, pause, stop, and volume. However, by setting the ShowControls parameter to False, these controls will be hidden. Instead, you can provide your own control mechanism through script. Here is some basic code that will display the viewer without showing any controls:



<OBJECT ID="mPlayer"
        classid="CLSID:22d6f312-b0f6-11d0-94ab-
        0080c74c7e95"
        TYPE="application/x-oleobject">
    <PARAM NAME="FileName" VALUE="playback.asf">
    <PARAM NAME="ShowControls" VALUE="FALSE">
</OBJECT>
You would then use script code similar to this


<img src="play.gif" title="Play" onclick="mPlayer.Play()">
<img src="pause.gif" title="Pause" onclick="mPlayer.Pause()">
<img src="stop.gif" title="Stop" onclick="mPlayer.Stop()">
to play, pause, or stop the player. There are many other properties, methods, and events exposed by the Media Player that you can use to customize your solution. Check out http://msdn.microsoft.com/windowsmedia/ for more detailed Windows Media Player programming information.

Q I develop content for both Internet Explorer and Netscape Navigator. In Navigator you can enumerate through the collection of plug-ins that a client's browser has installed. Internet Explorer has support for plug-ins through its object model, but I can't find an obvious way of enumerating this collection beyond testing for a specific plug-in. We need to look for Flash or a similar plug-in before we can play our content.

A Programs such as the Flash player are either Netscape plug-ins or ActiveX® controls. For best results in Internet Explorer you should use the ActiveX versions. For the most part, the same security and privacy issues exist for plug-ins and ActiveX controls. For example, Internet Explorer doesn't allow you to test for the existence of a plug-in because it would reveal information you shouldn't be able to access. Why? Let's say there was a particular plug-in or control that was only used on a particular site. Once you know that control exists on a client machine, you know the user has visited that particular site. And doing it in another browser amounts to snooping.
      That said, it is possible to do some rudimentary testing for the availability of different ActiveX controls by using the fact that within an initialized <object> container, the only recognizable elements are <param> and <object>. Any other elements or content is ignored. Thus, if the initial <object> is not able to be initialized for some reason, then any HTML elements and content within the container will be rendered as normal.
      It would also be possible to write an ActiveX control that would in turn be able to enumerate through the registry to detect available ActiveX controls or plug-ins.

Q Would repeatedly calling ASP functions (custom functions written in ASP) affect the performance of the ASP in any way? For example, if I implement the following code in ASP



<%
BeginForm()
    While Not(oRS.eof)
        StartTable()
        StartNewRow()
        StartNewCell()
        EndCell()
        EndRow()
        EndTable()
    Wend
EndForm()
%>
each of the previous functions will generate some HTML and the functions it calls are implemented in ASP.

A Doing virtually anything, in any programming language, will affect the performance of an application. So yes, calling a custom ASP function repeatedly will affect the performance of your ASP-based program.
      In your particular example, if you were to switch from using your custom functions StartTable and StartNewRow, and instead write it to run inline, you might notice speed improvements just because the process of making a function call takes a little time over and above the simple execution of the code within the function. However, the benefits and efficiencies of modularized code design often prove to be enough to outweigh any potential slowdown that might occur from using function calls.

Q I'm creating a Microsoft Outlook® form that will access a database on a network. Is there some way for the form to store custom data with the user configuration instead of with the Outlook item? Could a user make changes to this new custom preference from Outlook's Options dialog, or would I need to create a way to change it manually? The form will reside in a public folder. Is there a better way to store the reference to the database?

A It sounds like Digital Dashboard functionality in Outlook 2000 is just what you're looking for. Check out http://www.microsoft.com/DigitalNervousSystem/km/DigitalDashboard.htm to see if it provides the type of functionality you need.

Q In the Geektogeek column in the December 1999 issue of Microsoft Internet Developer (http://www.microsoft.com/mind/1299/geek/Geek1299.htm), a reader asked whether there was a way to write a program that searches eBay for the most bid upon items. You suggested writing a screen scraper program that would read the contents of a browser to gather data and manipulate it on the client.
      There is another way to do this. You could use the WebBrowser control, read in the contents of the Web page as a stream of text, and then parse it. Alternatively, if you could crack the SQL queries in their ASP pages, you might be able to send a URL string with the search string you want and have it return a result that way.

A Using a Web browser control to parse the text stream associated with the Web page is essentially the same thing as doing a screen scrape. The information you are parsing is intended for rendering on the screen, and your code is simply intercepting that process and attempting to understand what was meant to be displayed so you can redirect the data in another fashion.
      In some cases it might be possible to crack the database queries used by eBay to return a particular resultset. In fact, simply looking at the code on their Search page can provide you with a lot of information about their database queries. However, you would still be limited to rather rudimentary queries that retain eBay's predetermined query structure and display parameters, unless you then parse and scrape the returned data and then display it in your own format.

Robert Hess is an engineer in the Microsoft Developer Relations group. He provides ISVs with information to help them develop apps for Microsoft systems software. Send e-mail to webqa@microsoft.com.

From the March 2000 issue of MSDN Magazine.

Page view tracker