Microsoft HomeproductssearchsupportshopWrite Us   Microsoft Home
Magazine
 |  Community
 |  Workshop
 |  Tools & Samples
 |  Training
 |  Site Info

Workshop  |  Reusing Browser Technology

HTML Dialog Boxes


IE4/MSHTML allows you to create a modal dialog box that displays HTML using the ShowHTMLDialog function that is implemented in Mshtml.dll.

Using ShowHTMLDialog

To use ShowHTMLDialog, it is necessary to dynamically load and then call this function by using the LoadLibrary and GetProcAddress functions. The SHOWHTMLDIALOGFN type is defined in Mshtmhst.h to define the proper function type for ShowHTMLDialog. The ShowHTMLDialog Function sample shows a complete example using ShowHTMLDialog, including how to pass data to and receive data from the dialog. The following example shows how to obtain the address of the ShowHTMLDialog function.

#include <windows.h>
#include <mshtmhst.h>

{
HINSTANCE   hinstMSHTML = LoadLibrary(TEXT("MSHTML.DLL"));

if(hinstMSHTML)
   {
   SHOWHTMLDIALOGFN  *pfnShowHTMLDialog;
      
   pfnShowHTMLDialog = (SHOWHTMLDIALOGFN*)GetProcAddress(hinstMSHTML,
       TEXT("ShowHTMLDialog"));

   if(pfnShowHTMLDialog)
      {
      /*
      Perform initialization and then call ShowHTMLDialog.
      */
      }
   
   FreeLibrary(hinstMSHTML);
   }
}

The HTML for the dialog box is loaded from an IMoniker interface that is passed in the pmk parameter in ShowHTMLDialog. This moniker can be any moniker that evaluates to any HTML source or to a resource that uses the res: protocol. The CreateURLMoniker function can be used to create the IMoniker interface that is passed to ShowHTMLDialog.

The input parameters for the dialog box are passed in the pvaArgIn parameter in ShowHTMLDialog. The input parameters can be any information that can be passed in a VARIANT structure. In the dialog box HTML source, the input parameters are obtained from the dialogArguments property of the window object.

The output parameters for the dialog box are returned in the pvaArgOut parameter in ShowHTMLDialog. This is a VARIANT structure that you allocate. This structure must be initialized using the VariantInit function before calling ShowHTMLDialog. In the dialog box HTML source, the output parameters are set using the returnValue property of the window object.

Related Topics


Does this content meet your programming needs? Write us!

Back to topBack to top

© 1998 Microsoft Corporation. All rights reserved. Terms of use.

 

Magazine Home
Ask Jane
DHTML Dude
Extreme XML
For Starters
More or Hess
Servin' It Up
Site Lights
Web Men Talking
Member Community Home
Benefits: Freebies & Discounts
Benefits: Promote Your Site
Benefits: Connect with Your Peers
Benefits at a Glance
Online Special-Interest Groups
Your Membership
SBN Stores
Join Now
Workshop Home
Essentials
Content & Component Delivery
Component Development
Data Access & Databases
Design
DHTML, HTML & CSS
Extensible Markup Language (XML)
Languages & Development Tools
Messaging & Collaboration
Networking, Protocols & Data Formats
Reusing Browser Technology
Security & Cryptography
Server Technologies
Streaming & Interactive Media
Web Content Management
Workshop Index
Tools & Samples Home
Tools
Samples, Headers, Libs
Images
Sounds
Style Sheets
Web Fonts
Training Home
SBN Live Seminars
SBN Live Chats
Courses
Peer Support
CD-ROM Training
Books & Training Kits
Certification
SBN Home
New to SBN?
What's New on SBN
Site Map
Site Search
Glossary
Write Us
About This Site