⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intfdochostuihandler.pas

📁 JavaScript调用Delphi过程
💻 PAS
📖 第 1 页 / 共 2 页
字号:
{
  This demo application accompanies the article
  "How to call Delphi code from scripts running in a TWebBrowser" at
  http://www.delphidabbler.com/articles?article=22.

  This unit defines the IDocHostUIHandler interface and associated structures.

  This code is copyright (c) P D Johnson (www.delphidabbler.com), 2005-2006.

  v1.0 of 2005/05/09 - original version named IntfUIHandlers.pas
  v1.1 of 2006/02/11 - revision based on unit of same name from article at
                       http://www.delphidabbler.com/articles?article=22
}


{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$WARN UNSAFE_TYPE OFF}


unit IntfDocHostUIHandler;

interface

uses
  // Delphi
  Windows, ActiveX;


const

  {
    Set of flags that indicate the capabilities of an IDocHostUIHandler
    implementation and are used in a TDocHostUIInfo record.
  }
  DOCHOSTUIFLAG_DIALOG                      = $00000001;
    {Disables selection of text in form}
  DOCHOSTUIFLAG_DISABLE_HELP_MENU           = $00000002;
    {MSHTML does not add the Help menu item to the container's menu}
  DOCHOSTUIFLAG_NO3DBORDER                  = $00000004;
    {MSHTML does not use 3-D borders on any frames or framesets. To turn the
    border off on only the outer frameset use DOCHOSTUIFLAG_NO3DOUTERBORDER}
  DOCHOSTUIFLAG_SCROLL_NO                   = $00000008;
    {MSHTML does not have scroll bars}
  DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE     = $00000010;
    {MSHTML does not execute any script when loading pages}
  DOCHOSTUIFLAG_OPENNEWWIN                  = $00000020;
    {MSHTML opens a site in a new window when a link is clicked rather than
    browse to the new site using the same browser window}
  DOCHOSTUIFLAG_DISABLE_OFFSCREEN           = $00000040;
    {Not implemented}
  DOCHOSTUIFLAG_FLAT_SCROLLBAR              = $00000080;
    {MSHTML uses flat scroll bars for any user interface (UI) it displays}
  DOCHOSTUIFLAG_DIV_BLOCKDEFAULT            = $00000100;
    {MSHTML inserts the div tag if a return is entered in edit mode. Without
    this flag, MSHTML will use the p tag}
  DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY     = $00000200;
    {MSHTML only becomes UI active if the mouse is clicked in the client area of
    the window. It does not become UI active if the mouse is clicked on a
    nonclient area, such as a scroll bar}
  DOCHOSTUIFLAG_OVERRIDEBEHAVIORFACTORY     = $00000400;
    {MSHTML consults the host before retrieving a behavior from the URL
    specified on the page. If the host does not support the behavior, MSHTML
    does not proceed to query other hosts or instantiate the behavior itself,
    even for behaviors developed in script (HTML Components (HTCs))}
  DOCHOSTUIFLAG_CODEPAGELINKEDFONTS         = $00000800;
    {IE5 or later. Provides font selection compatibility for Outlook Express. If
    the flag is enabled, the displayed characters are inspected to determine
    whether the current font supports the code page. If disabled, the current
    font is used, even if it does not contain a glyph for the character. This
    flag assumes that the user is using IE5 and OE4.0}
  DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8   = $00001000;
    {IE5 or later. Controls how nonnative URLs are transmitted over the
    Internet. Nonnative refers to characters outside the multibyte encoding of
    the URL. If this flag is set, the URL is not submitted to the server in
    UTF-8 encoding}
  DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8    = $00002000;
    {IE5 or later. Controls how nonnative URLs are transmitted over the
    Internet. Nonnative refers to characters outside the multibyte encoding of
    the URL. If this flag is set, the URL is submitted to the server in
    UTF-8 encoding}
  DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE   = $00004000;
    {IE5 or later. This flag enables the AutoComplete feature for forms in the
    hosted browser. The Intelliforms feature is only turned on if the user has
    previously enabled it. If the user has turned the AutoComplete feature off
    for forms, it is off whether this flag is specified or not}
  DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION   = $00010000;
    {IE5 or later. This flag enables the host to specify that navigation should
    happen in place. This means that applications hosting MSHTML directly can
    specify that navigation happen in the application's window. For instance,
    if this flag is set, you can click a link in HTML mail and navigate in the
    mail instead of opening a new IE window}
  DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION     = $00020000;
    {IE5 or later. During initialization, the host can set this flag to enable
    Input Method Editor (IME) reconversion, allowing computer users to employ
    IME reconversion while browsing Web pages}
  DOCHOSTUIFLAG_THEME                       = $00040000;
    {IE6 or later. Specifies that the hosted browser should use themes for pages
    it displays}
  DOCHOSTUIFLAG_NOTHEME                     = $00080000;
    {IE6 or later. Specifies that the hosted browser should not use themes for
    pages it displays}
  DOCHOSTUIFLAG_NOPICS                      = $00100000;
    {IE6 or later. Disables PICS ratings for the hosted browser}
  DOCHOSTUIFLAG_NO3DOUTERBORDER             = $00200000;
    {IE6 or later. Turns off any 3-D border on the outermost frame or frameset
    only. To turn borders off on all frame sets, use DOCHOSTUIFLAG_NO3DBORDER}
  // *** query these values
  DOCHOSTUIFLAG_DISABLE_EDIT_NS_FIXUP       = $1;
    {IE6 or later. Disables the automatic correction of namespaces when editing
    HTML elements}
  DOCHOSTUIFLAG_LOCAL_MACHINE_ACCESS_CHECK  = $1;
    {IE6 or later. Prevents Web sites in the Internet zone from accessing files
    in the Local Machine zone}
  DOCHOSTUIFLAG_DISABLE_UNTRUSTEDPROTOCOL   = $1;
    {IE6 or later. Turns off untrusted protocols. Untrusted protocols include
    ms-its, ms-itss, its, and mk:@msitstore}

  {
    Set of values used to indicate the proper action on a double-click event.
    Used in a TDocHostUIInfo record.
  }
  DOCHOSTUIDBLCLK_DEFAULT         = 0;
    {Perform the default action}
  DOCHOSTUIDBLCLK_SHOWPROPERTIES  = 1;
    {Show the item's properties}
  DOCHOSTUIDBLCLK_SHOWCODE        = 2;
    {Show the page's source}

  {
    Values that that indicate the type of user interface. Used in
    IDocHostUIHandler.ShowUI method.
  }
  DOCHOSTUITYPE_BROWSE = 0;
    {Indicates the user interface is for browsing}
  DOCHOSTUITYPE_AUTHOR = 1;
    {Value that indicates the user interface is for authoring}


type

  {
  TDocHostUIInfo:
    Used by the IDocHostUIHandler.GetHostInfo method to allow MSHTML to
    retrieve information about the host's UI requirements.
  }
  TDocHostUIInfo = record
    cbSize: ULONG;
      {size of structure in bytes}
    dwFlags: DWORD;
      {one or more DOCHOSTUIFLAG_* flags that specify UI capabilitiess of host}
    dwDoubleClick: DWORD;
      {a DOCHOSTUIDBLCLK_* value that specifies operation in response to a
      double-click}
    pchHostCss: PWChar;
      {pointer to set of CSS rules set by host}
    pchHostNS: PWChar;
      {pointer to a ';' delimited namespace list that allows declaration of
      namespaces for custom tags on the page}
  end;

  {
  PDocHostUIInfo:
    Pointer to TDocHostUIInfo record.
  }
  PDocHostUIInfo = ^TDocHostUIInfo;

  {
  IDocHostUIHandler:
    This custom interface enables an application hosting the WebBrowser Control
    or automating IE to replace the menus, toolbars, and context menus used by
    MSHTML.
  }
  IDocHostUIHandler = interface(IUnknown)
    ['{bd3f23c0-d43e-11cf-893b-00aa00bdce1a}']
    function ShowContextMenu(const dwID: DWORD; const ppt: PPOINT;
      const pcmdtReserved: IUnknown; const pdispReserved: IDispatch): HResult;
      stdcall;
      {Called by MSHTML to display a shortcut menu.
        @param dwID [in] specifies identifier of the shortcut menu to be
          displayed. This identifier is a bitwise shift of the value 0x1 by the
          shortcut menu values (e.g., CONTEXT_MENU_DEFAULT) defined in
          Mshtmhst.h. Values are:
            $02 value of (0x1 shl CONTEXT_MENU_DEFAULT)
            $04 value of (0x1 shl CONTEXT_MENU_CONTROL)
            $08 value of (0x1 shl CONTEXT_MENU_TABLE)
            $10 value of (0x1 shl CONTEXT_MENU_TEXTSELECT)
            $30 value of (0x1 shl CONTEXT_MENU_ANCHOR)
            $20 value of (0x1 shl CONTEXT_MENU_UNKNOWN).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -