home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / internet / weblibev / maindlg.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-10-31  |  67.3 KB  |  2,620 lines

  1. { ============================================================================
  2.   Copyright 1995 by Potomac Software, Inc. Use of this material is subject to
  3.   the terms and conditions of the software license agreement.
  4.   ============================================================================ }
  5.  
  6. unit Maindlg;
  7.  
  8. interface
  9.  
  10. uses
  11.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  12.   Forms, Dialogs, StdCtrls, Weblib, Htmlpars, Weblibapidlg, ApiDlgConstants;
  13.  
  14. type
  15.   TMainDlgForm = class(TForm)
  16.     API_GRPBOX: TGroupBox;
  17.     BROWSER_RADIO: TRadioButton;
  18.     TOOLBAR_RADIO: TRadioButton;
  19.     HTML_RADIO: TRadioButton;
  20.     UTIL_RADIO: TRadioButton;
  21.     API_STATIC: TLabel;
  22.     API_LIST: TListBox;
  23.     OPENCLOSE_BTN: TButton;
  24.     STATUS_BTN: TButton;
  25.     INFO_BTN: TButton;
  26.     EXIT_BTN: TButton;
  27.     INFO_STATIC: TLabel;
  28.     INFO_LIST: TListBox;
  29.     PROMPT_STATIC: TLabel;
  30.  
  31.     procedure FormCreate(Sender: TObject);
  32.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  33.  
  34.     procedure ShowBrowserAPI(Sender: TObject);
  35.     procedure BrowserUI;
  36.     procedure BrowserNotifications;
  37.     procedure BrowserStatus;
  38.  
  39.     procedure ShowToolbarAPI(Sender: TObject);
  40.     procedure ToolbarUI;
  41.     procedure ToolbarStatus;
  42.     procedure ToolbarNotifications;
  43.  
  44.     procedure ShowParserAPI(Sender: TObject);
  45.     procedure ParserUI;
  46.     procedure ParserNotifications;
  47.     procedure ParserStatus;
  48.  
  49.     procedure ShowUtilAPI(Sender: TObject);
  50.     procedure UtilityUI;
  51.     procedure UtilityNotifications;
  52.     procedure UtilityStatus;
  53.  
  54.     procedure ApiClick(Sender: TObject);
  55.     procedure ApiDblClick(Sender: TObject);
  56.  
  57.     procedure OpenClose(Sender: TObject);
  58.     procedure ExitDlg(Sender: TObject);
  59.     procedure ShowNotifications(Sender: TObject);
  60.     procedure ShowStatus(Sender: TObject);
  61.  
  62.     procedure ConnectBrowser;
  63.     procedure DisconnectBrowser;
  64.     procedure CreateToolbar;
  65.     procedure DeleteToolbar;
  66.     procedure ParseHtml;
  67.     procedure EndParse;
  68.     procedure AccessFormData;
  69.  
  70.     procedure BrowserCallout;
  71.     procedure ToolbarCallout;
  72.     procedure ParserCallout;
  73.     procedure UtilityCallout;
  74.  
  75.     procedure GetWindowInfo;
  76.     procedure ListWindows;
  77.     procedure ActivateWindow;
  78.     procedure CloseWindow;
  79.     procedure SetWindowPos;
  80.     procedure ShowWindow;
  81.     procedure ShowFile;
  82.     procedure OpenURL;
  83.     procedure SaveURL;
  84.     procedure PostFormData;
  85.     procedure SaveFormData;
  86.     procedure RegisterProtocol;
  87.     procedure UnregisterProtocol;
  88.     procedure RegisterURLEcho;
  89.     procedure UnregisterURLEcho;
  90.     procedure RegisterViewer;
  91.     procedure UnregisterViewer;
  92.     procedure RegisterWindowChange;
  93.     procedure UnregisterWindowChange;
  94.     procedure ParseAnchor;
  95.     procedure GetVersion;
  96.     procedure QueryURLFile;
  97.     procedure SetNotifyMethod;
  98.  
  99.     procedure IsToolbarActive;
  100.     procedure SetActiveToolbar;
  101.     procedure AddToolbarButton;
  102.     procedure RemoveToolbarButton;
  103.     procedure IsToolbarButtonVisible;
  104.     procedure ShowToolbarButton;
  105.     procedure EnableToolbarButton;
  106.     procedure IsToolbarButtonEnabled;
  107.     procedure GetToolbarText;
  108.     procedure SetToolbarText;
  109.     procedure GetToolbarFont;
  110.     procedure SetToolbarFont;
  111.     procedure GetToolbarBkgnd;
  112.     procedure SetToolbarBkgnd;
  113.     procedure GetToolbarTextColor;
  114.     procedure SetToolbarTextColor;
  115.  
  116.     procedure HtmlEnumParseTree;
  117.     procedure HtmlGetChild;
  118.     procedure HtmlGetParent;
  119.     procedure HtmlGetSibling;
  120.     procedure HtmlGetElementType;
  121.     procedure HtmlGetElementText;
  122.     procedure HtmlGetTextAttr;
  123.     procedure HtmlGetTagName;
  124.     procedure HtmlGetTagType;
  125.     procedure HtmlGetTagAttr;
  126.     procedure HtmlExtractTagAttr;
  127.     procedure HtmlFindText;
  128.     procedure HtmlFindSpecial;
  129.     procedure HtmlFindComment;
  130.     procedure HtmlFindTagType;
  131.     procedure HtmlFindTagName;
  132.     procedure HtmlFindTagAttr;
  133.     procedure HtmlEnumFindText;
  134.     procedure HtmlEnumFindSpecial;
  135.     procedure HtmlEnumFindComment;
  136.     procedure HtmlEnumFindTagType;
  137.     procedure HtmlEnumFindTagName;
  138.     procedure HtmlEnumFindTagAttr;
  139.  
  140.     procedure AppendFormData;
  141.     procedure GetFormDataLength;
  142.     procedure ParseAbsoluteURL;
  143.  
  144.     procedure ShowBoolResult(bResult: Bool; const szName: String);
  145.     procedure ShowStrResult(const szParm: String; const szName: String);
  146.     procedure ShowStrResult2(const szParm1: String; const szParm2: String;
  147.         const szName: String);
  148.  
  149.     procedure AddProgressString(const szMsg: String);
  150.     function MakeEnumHtmlString(LParam: LongInt; WParam: Word) : String;
  151.  
  152.   private
  153.       { notification string arrays }
  154.       nfyShowFile: TStrings;
  155.     nfyOpenURL: TStrings;
  156.     nfySaveURL: TStrings;
  157.     nfyPostFormData: TStrings;
  158.     nfySaveFormData: TStrings;
  159.     nfyRegProtocol: TStrings;
  160.     nfyRegURLEcho: TStrings;
  161.     nfyRegViewer: TStrings;
  162.     nfyRegWindowChange: TStrings;
  163.     nfyToolbar: TStrings;
  164.     nfyEnumParseTree: TStrings;
  165.     nfyEnumFindText: TStrings;
  166.     nfyEnumFindSpecial: TStrings;
  167.     nfyEnumFindComment: TStrings;
  168.     nfyEnumFindTagType: TStrings;
  169.     nfyEnumFindTagName: TStrings;
  170.     nfyEnumFindTagAttr: TStrings;
  171.  
  172.     staRegProtocol: TStrings;
  173.     staRegViewer: TStrings;
  174.     staRegWindowChange: TStrings;     { really holds DWORDs }
  175.     staToolbar: TStrings;              { really holds UINTs }
  176.     staRegURLEcho: Bool;
  177.  
  178.   public
  179.     procedure HandleWeblibNotifyEvent (var msg: TMessage);
  180.         message WM_WEBLIB_NOTIFY;
  181.     procedure HandleEnumParseTree (var msg: TMessage);
  182.         message WM_WEBLIB_ENUMPARSETREE;
  183.      procedure HandleEnumFindText (var msg: TMessage);
  184.         message WM_WEBLIB_ENUMFINDTEXT;
  185.      procedure HandleEnumFindSpecial (var msg: TMessage);
  186.         message WM_WEBLIB_ENUMFINDSPEC;
  187.      procedure HandleEnumFindComment (var msg: TMessage);
  188.         message WM_WEBLIB_ENUMFINDCOMM;
  189.      procedure HandleEnumFindTagType (var msg: TMessage);
  190.         message WM_WEBLIB_ENUMFINDTAGTYPE;
  191.      procedure HandleEnumFindTagName (var msg: TMessage);
  192.         message WM_WEBLIB_ENUMFINDTAGNAME;
  193.      procedure HandleEnumFindTagAttr (var msg: TMessage);
  194.         message WM_WEBLIB_ENUMFINDTAGATTR;
  195.   end;
  196.  
  197. var
  198.   MainDlgForm: TMainDlgForm;
  199.  
  200. implementation
  201.  
  202. var
  203.     hBrowser: Weblib.HBROWSER;
  204.     hToolbar: Weblib.HTOOLBAR;
  205.     hParse: Htmlpars.HPARSE;
  206.     hFormData: Weblib.HFORMDATA;
  207.  
  208.     hfontToolbar: HFont;
  209.     hfontButton: HFont;
  210.  
  211.     hCurrElement: HELEMENT;
  212.     hCurrTagAttr: HTAGATTR;
  213.  
  214. {$R *.DFM}
  215.  
  216. procedure TMainDlgForm.FormCreate(Sender: TObject);
  217. begin
  218.     { initialize members }
  219.     hBrowser := 0;
  220.     hToolbar := 0;
  221.     hParse := 0;
  222.     hFormData := 0;
  223.  
  224.     hfontToolbar := 0;
  225.     hfontButton := 0;
  226.  
  227.     hCurrElement := 0;
  228.     hCurrTagAttr := 0;
  229.  
  230.     { create notification string lists for holding events }
  231.     nfyShowFile := TStringList.Create;
  232.     nfyOpenURL := TStringList.Create;
  233.     nfySaveURL := TStringList.Create;
  234.     nfyPostFormData := TStringList.Create;
  235.     nfySaveFormData := TStringList.Create;
  236.     nfyRegProtocol := TStringList.Create;
  237.     nfyRegURLEcho := TStringList.Create;
  238.     nfyRegViewer := TStringList.Create;
  239.     nfyRegWindowChange := TStringList.Create;
  240.     nfyToolbar := TStringList.Create;
  241.     nfyEnumParseTree := TStringList.Create;
  242.     nfyEnumFindText := TStringList.Create;
  243.     nfyEnumFindSpecial := TStringList.Create;
  244.     nfyEnumFindComment := TStringList.Create;
  245.     nfyEnumFindTagType := TStringList.Create;
  246.     nfyEnumFindTagName := TStringList.Create;
  247.     nfyEnumFindTagAttr := TStringList.Create;
  248.  
  249.     { create status string lists }
  250.     staRegProtocol := TStringList.Create;
  251.     staRegViewer := TStringList.Create;
  252.     staRegWindowChange := TStringList.Create;
  253.     staToolbar := TStringList.Create;
  254.  
  255.     staRegURLEcho := False;
  256.  
  257.     { use canned sub-classing to handle enable of main window after API dlg }
  258.     if not ApiDlgSubclass4GL(Handle, 5000) then
  259.         Application.MessageBox('ApiDlgSubclass4GL failed','Error',MB_OK);
  260.     if not ApiDlgNotifyOnWindowDestroy(Handle, 5000) then
  261.         Application.MessageBox('ApiDlgNotifyOnWindowDestroy failed','Error',MB_OK);
  262.  
  263.     SendMessage(INFO_LIST.Handle,LB_SETHORIZONTALEXTENT,INFO_LIST.Width * 3,0);
  264.     ShowBrowserAPI(BROWSER_RADIO);
  265. end;
  266.  
  267. procedure TMainDlgForm.FormClose(Sender: TObject; var Action: TCloseAction);
  268. begin
  269.       if not ApiDlgUnsubclass4GL(Handle) then
  270.         Application.MessageBox('ApiDlgUnsubclass4GL failed','Error',MB_OK);
  271.  
  272.     if hBrowser <> 0 then
  273.         WLDisconnectBrowser(hBrowser,True);
  274.     if hToolbar <> 0 then
  275.         WLDeleteToolbar(hToolbar);
  276.     if hParse <> 0 then
  277.         WLHtmlEndParse(hParse);
  278.  
  279.     if hfontToolbar <> 0 then
  280.         ApiDlgFreeFont4GL(hfontToolbar);
  281.     if hfontButton <> 0 then
  282.         ApiDlgFreeFont4GL(hfontButton);
  283.  
  284.     nfyShowFile.Free;
  285.     nfyOpenURL.Free;
  286.     nfySaveURL.Free;
  287.     nfyPostFormData.Free;
  288.     nfySaveFormData.Free;
  289.     nfyRegProtocol.Free;
  290.     nfyRegURLEcho.Free;
  291.     nfyRegViewer.Free;
  292.     nfyRegWindowChange.Free;
  293.     nfyToolbar.Free;
  294.     nfyEnumParseTree.Free;
  295.     nfyEnumFindText.Free;
  296.     nfyEnumFindSpecial.Free;
  297.     nfyEnumFindComment.Free;
  298.     nfyEnumFindTagType.Free;
  299.     nfyEnumFindTagName.Free;
  300.     nfyEnumFindTagAttr.Free;
  301.  
  302.     staRegProtocol.Free;
  303.     staRegViewer.Free;
  304.     staRegWindowChange.Free;
  305.     staToolbar.Free;
  306. end;
  307.  
  308. procedure TMainDlgForm.ShowBrowserAPI(Sender: TObject);
  309. begin
  310.     API_LIST.Items.Clear;
  311.     API_STATIC.Caption := 'Browser APIs';
  312.  
  313.     if hBrowser = 0 then
  314.     begin
  315.         OPENCLOSE_BTN.Caption := '&Connect...';
  316.     end
  317.     else
  318.     begin
  319.         OPENCLOSE_BTN.Caption := '&Disconnect';
  320.  
  321.         API_LIST.Items.Add('GetWindowInfo');
  322.         API_LIST.Items.Add('ListWindows');
  323.         API_LIST.Items.Add('ActivateWindow');
  324.         API_LIST.Items.Add('CloseWindow');
  325.         API_LIST.Items.Add('SetWindowPos');
  326.         API_LIST.Items.Add('ShowWindow');
  327.         API_LIST.Items.Add('ShowFile');
  328.         API_LIST.Items.Add('OpenURL');
  329.         API_LIST.Items.Add('SaveURL');
  330.         API_LIST.Items.Add('PostFormData');
  331.         API_LIST.Items.Add('SaveFormData');
  332.         API_LIST.Items.Add('RegisterProtocol');
  333.         API_LIST.Items.Add('UnregisterProtocol');
  334.         API_LIST.Items.Add('RegisterURLEcho');
  335.         API_LIST.Items.Add('UnregisterURLEcho');
  336.         API_LIST.Items.Add('RegisterViewer');
  337.         API_LIST.Items.Add('UnregisterViewer');
  338.         API_LIST.Items.Add('RegisterWindowChange');
  339.         API_LIST.Items.Add('UnregisterWindowChange');
  340.         API_LIST.Items.Add('ParseAnchor');
  341.         API_LIST.Items.Add('GetVersion');
  342.         API_LIST.Items.Add('QueryURLFile');
  343.         API_LIST.Items.Add('SetNotifyMethod');
  344.  
  345.         API_LIST.ItemIndex := 0;
  346.     end;
  347.  
  348.     OPENCLOSE_BTN.Enabled := True;
  349. end;
  350.  
  351. procedure TMainDlgForm.ShowToolbarAPI(Sender: TObject);
  352. begin
  353.     API_LIST.Items.Clear;
  354.     API_STATIC.Caption := 'Toolbar APIs';
  355.  
  356.     if hToolbar = 0 then
  357.     begin
  358.         OPENCLOSE_BTN.Caption := '&Create...';
  359.     end
  360.     else
  361.     begin
  362.         OPENCLOSE_BTN.Caption := '&Delete';
  363.  
  364.         API_LIST.Items.Add('IsToolbarActive');
  365.         API_LIST.Items.Add('SetActiveToolbar');
  366.         API_LIST.Items.Add('AddToolbarButton');
  367.         API_LIST.Items.Add('RemoveToolbarButton');
  368.         API_LIST.Items.Add('IsToolbarButtonVisible');
  369.         API_LIST.Items.Add('ShowToolbarButton');
  370.         API_LIST.Items.Add('EnableToolbarButton');
  371.         API_LIST.Items.Add('IsToolbarButtonEnabled');
  372.         API_LIST.Items.Add('GetToolbarText');
  373.         API_LIST.Items.Add('SetToolbarText');
  374.         API_LIST.Items.Add('GetToolbarFont');
  375.         API_LIST.Items.Add('SetToolbarFont');
  376.         API_LIST.Items.Add('GetToolbarBkgnd');
  377.         API_LIST.Items.Add('SetToolbarBkgnd');
  378.         API_LIST.Items.Add('GetToolbarTextColor');
  379.         API_LIST.Items.Add('SetToolbarTextColor');
  380.  
  381.         API_LIST.ItemIndex := 0;
  382.     end;
  383.  
  384.     OPENCLOSE_BTN.Enabled := True;
  385. end;
  386.  
  387. procedure TMainDlgForm.ShowParserAPI(Sender: TObject);
  388. begin
  389.     API_LIST.Items.Clear;
  390.     API_STATIC.Caption := 'Html APIs';
  391.  
  392.     if hParse = 0 then
  393.     begin
  394.         OPENCLOSE_BTN.Caption := '&Parse...';
  395.     end
  396.     else
  397.     begin
  398.         OPENCLOSE_BTN.Caption := '&End Parse';
  399.  
  400.         API_LIST.Items.Add('EnumParseTree');
  401.         API_LIST.Items.Add('GetChild');
  402.         API_LIST.Items.Add('GetParent');
  403.         API_LIST.Items.Add('GetSibling');
  404.         API_LIST.Items.Add('GetElementType');
  405.         API_LIST.Items.Add('GetElementText');
  406.         API_LIST.Items.Add('GetTextAttr');
  407.         API_LIST.Items.Add('GetTagName');
  408.         API_LIST.Items.Add('GetTagType');
  409.         API_LIST.Items.Add('GetTagAttr');
  410.         API_LIST.Items.Add('ExtractTagAttr');
  411.         API_LIST.Items.Add('FindText');
  412.         API_LIST.Items.Add('FindSpecial');
  413.         API_LIST.Items.Add('FindComment');
  414.         API_LIST.Items.Add('FindTagType');
  415.         API_LIST.Items.Add('FindTagName');
  416.         API_LIST.Items.Add('FindTagAttr');
  417.         API_LIST.Items.Add('EnumFindText');
  418.         API_LIST.Items.Add('EnumFindSpecial');
  419.         API_LIST.Items.Add('EnumFindComment');
  420.         API_LIST.Items.Add('EnumFindTagType');
  421.         API_LIST.Items.Add('EnumFindTagName');
  422.         API_LIST.Items.Add('EnumFindTagAttr');
  423.  
  424.         API_LIST.ItemIndex := 0;
  425.     end;
  426.  
  427.     OPENCLOSE_BTN.Enabled := True;
  428. end;
  429.  
  430. procedure TMainDlgForm.ShowUtilAPI(Sender: TObject);
  431. begin
  432.     API_LIST.Items.Clear;
  433.     API_STATIC.Caption := 'Utility APIs';
  434.     OPENCLOSE_BTN.Caption := '&Access Data...';
  435.  
  436.     API_LIST.Items.Add('AppendFormData');
  437.     API_LIST.Items.Add('GetFormDataLength');
  438.     API_LIST.Items.Add('ParseAbsoluteURL');
  439.  
  440.     API_LIST.ItemIndex := 0;
  441.  
  442.     if hFormData = 0 then
  443.         OPENCLOSE_BTN.Enabled := False
  444.     else
  445.         OPENCLOSE_BTN.Enabled := True;
  446. end;
  447.  
  448. procedure TMainDlgForm.ApiDblClick(Sender: TObject);
  449. begin
  450.     if BROWSER_RADIO.Checked then
  451.         BrowserCallout
  452.     else
  453.         if TOOLBAR_RADIO.Checked then
  454.             ToolbarCallout
  455.         else
  456.             if HTML_RADIO.Checked then
  457.                  ParserCallout
  458.              else
  459.                  if UTIL_RADIO.Checked then
  460.                       UtilityCallout;
  461. end;
  462.  
  463. procedure TMainDlgForm.ApiClick(Sender: TObject);
  464. begin
  465.     INFO_LIST.Items.Clear;
  466.  
  467.     if BROWSER_RADIO.Checked then
  468.         BrowserUI
  469.     else
  470.         if TOOLBAR_RADIO.Checked then
  471.             ToolbarUI
  472.         else
  473.             if HTML_RADIO.Checked then
  474.                  ParserUI
  475.              else
  476.                  if UTIL_RADIO.Checked then
  477.                       UtilityUI;
  478. end;
  479.  
  480. procedure TMainDlgForm.OpenClose(Sender: TObject);
  481. begin
  482.     if BROWSER_RADIO.Checked then
  483.         if hBrowser = 0 then
  484.             ConnectBrowser
  485.         else
  486.             DisconnectBrowser
  487.     else
  488.         if TOOLBAR_RADIO.Checked then
  489.             if hToolbar = 0 then
  490.                  CreateToolbar
  491.              else
  492.                  DeleteToolbar
  493.         else
  494.             if HTML_RADIO.Checked then
  495.                  if hParse = 0 then
  496.                       ParseHtml
  497.                   else
  498.                       EndParse
  499.              else
  500.                  if UTIL_RADIO.Checked then
  501.                       AccessFormData;
  502. end;
  503.  
  504. procedure TMainDlgForm.ExitDlg(Sender: TObject);
  505. begin
  506.     Close;
  507. end;
  508.  
  509. procedure TMainDlgForm.ShowNotifications(Sender: TObject);
  510. begin
  511.     if BROWSER_RADIO.Checked then
  512.         BrowserNotifications
  513.     else
  514.         if TOOLBAR_RADIO.Checked then
  515.             ToolbarNotifications
  516.         else
  517.             if HTML_RADIO.Checked then
  518.                  ParserNotifications
  519.              else
  520.                  if UTIL_RADIO.Checked then
  521.                       UtilityNotifications;
  522. end;
  523.  
  524. procedure TMainDlgForm.ShowStatus(Sender: TObject);
  525. begin
  526.     if BROWSER_RADIO.Checked then
  527.         BrowserStatus
  528.     else
  529.         if TOOLBAR_RADIO.Checked then
  530.             ToolbarStatus
  531.         else
  532.             if HTML_RADIO.Checked then
  533.                  ParserStatus
  534.              else
  535.                  if UTIL_RADIO.Checked then
  536.                       UtilityStatus;
  537. end;
  538.  
  539. procedure TMainDlgForm.ConnectBrowser;
  540. var
  541.     bStart: Bool;
  542.     bSend: Bool;
  543.     bPost: Bool;
  544.     WOptions: Word;
  545. begin
  546.     bStart := True;
  547.     bSend := False;
  548.     bPost := True;
  549.  
  550.     if ApiDlgConnectBrowser(bStart,bSend,bPost) then
  551.     begin
  552.         wOptions := 0;
  553.         if bStart then
  554.             wOptions := wOptions or WL_STARTBROWSER;
  555.         if bSend then
  556.             wOptions := wOptions or WL_SENDMESSAGE;
  557.         if bPost then
  558.             wOptions := wOptions or WL_POSTMESSAGE;
  559.  
  560.         hBrowser := WLConnectBrowser(wOptions);
  561.         if hBrowser = 0 then
  562.             ShowBoolResult(False,'WLConnectBrowser')
  563.         else
  564.         begin
  565.             ShowBoolResult(True,'WLConnectBrowser');
  566.             ShowBrowserAPI(BROWSER_RADIO);
  567.         end;
  568.     end;
  569. end;
  570.  
  571. procedure TMainDlgForm.DisconnectBrowser;
  572. var
  573.     bExit: Bool;
  574. begin
  575.     bExit := True;
  576.  
  577.     if ApiDlgDisconnectBrowser(bExit) then
  578.     begin
  579.         if WLDisconnectBrowser(hBrowser,bExit) then
  580.         begin
  581.             hBrowser := 0;
  582.              ShowBoolResult(True,'WLDisconnectBrowser');
  583.              ShowBrowserAPI(BROWSER_RADIO);
  584.  
  585.              nfyShowFile.Clear;
  586.                 nfyOpenURL.Clear;
  587.                 nfySaveURL.Clear;
  588.                 nfyPostFormData.Clear;
  589.                 nfySaveFormData.Clear;
  590.                 nfyRegProtocol.Clear;
  591.                 nfyRegURLEcho.Clear;
  592.                 nfyRegViewer.Clear;
  593.                 nfyRegWindowChange.Clear;
  594.                 nfyToolbar.Clear;
  595.  
  596.                 staRegProtocol.Clear;
  597.                 staRegViewer.Clear;
  598.                 staRegWindowChange.Clear;
  599.              staRegURLEcho := False;
  600.  
  601.         end
  602.         else
  603.             ShowBoolResult(False,'WLDisconnectBrowser');
  604.     end;
  605. end;
  606.  
  607. procedure TMainDlgForm.CreateToolbar;
  608. var
  609.     szMenu: array[0..63] of Char;
  610. begin
  611.     szMenu[0] := Chr(0);
  612.  
  613.     if ApiDlgCreateToolbar(szMenu,SizeOf(szMenu)) then
  614.     begin
  615.         hToolbar := WLCreateToolbar(szMenu,Handle,WM_WEBLIB_NOTIFY);
  616.         if hToolbar = 0 then
  617.             ShowBoolResult(False,'WLCreateToolbar')
  618.         else
  619.         begin
  620.             ShowBoolResult(True,'WLCreateToolbar');
  621.              ShowToolbarAPI(TOOLBAR_RADIO);
  622.         end;
  623.     end;
  624. end;
  625.  
  626. procedure TMainDlgForm.DeleteToolbar;
  627. begin
  628.     if WLDeleteToolbar(hToolbar) then
  629.          ShowBoolResult(False,'WLDeleteToolbar')
  630.     else
  631.         ShowBoolResult(True,'WLDeleteToolbar');
  632.  
  633.     hToolbar := 0;
  634.     ShowToolbarAPI(TOOLBAR_RADIO);
  635.  
  636.     nfyToolbar.Clear;
  637.     staToolbar.Clear;
  638. end;
  639.  
  640. procedure TMainDlgForm.ParseHtml;
  641. var
  642.     szFile: array[0..255] of Char;
  643.     szBuf: array[0..1023] of Char;
  644.     bAttr: Bool;
  645.     bClosing: Bool;
  646.     wOptions: Word;
  647. begin
  648.     szFile[0] := Chr(0);
  649.     szBuf[0] := Chr(0);
  650.     bAttr := False;
  651.     bClosing := False;
  652.  
  653.     if ApiDlgHtmlParse(szFile,SizeOf(szFile),szBuf,SizeOf(szBuf),bAttr,bClosing) then
  654.     begin
  655.         hCurrElement := WL_ROOTELEMENT;
  656.         hCurrTagAttr := 0;
  657.  
  658.         wOptions := 0;
  659.         if bAttr then
  660.             wOptions := wOptions or WL_KEEPATTRIBUTETAG;
  661.         if bClosing then
  662.             wOptions := wOptions or WL_KEEPCLOSINGTAG;
  663.  
  664.         if StrLen(szFile) > 0 then
  665.             hParse := WLHtmlParseFile(szFile,wOptions)
  666.         else
  667.             hParse := WLHtmlParseBuf(szBuf,StrLen(szBuf),wOptions);
  668.  
  669.         if hParse = 0 then
  670.             ShowBoolResult(False,'WLHtmlParseFile/Buf')
  671.         else
  672.         begin
  673.             ShowBoolResult(True,'WLHtmlParseFile/Buf');
  674.              ShowParserAPI(HTML_RADIO);
  675.         end;
  676.     end
  677. end;
  678.  
  679. procedure TMainDlgForm.EndParse;
  680. begin
  681.     if WLHtmlEndParse(hParse) then
  682.         ShowBoolResult(True,'WLHtmlEndParse')
  683.     else
  684.         ShowBoolResult(False,'WLHtmlEndParse');
  685.  
  686.     hParse := 0;
  687.     ShowParserAPI(HTML_RADIO);
  688.  
  689.     nfyEnumParseTree.Clear;
  690.     nfyEnumFindText.Clear;
  691.     nfyEnumFindSpecial.Clear;
  692.     nfyEnumFindComment.Clear;
  693.     nfyEnumFindTagType.Clear;
  694.     nfyEnumFindTagName.Clear;
  695.     nfyEnumFindTagAttr.Clear;
  696. end;
  697.  
  698. procedure TMainDlgForm.AccessFormData;
  699. var
  700.     szRetBuf: array[0..1023] Of Char;
  701. begin
  702.     szRetBuf[0] := Chr(0);
  703.  
  704.     if WLGetFormDataLength(hFormData) <= SizeOf(szRetBuf) then
  705.         if WLAccessFormData(hFormData,szRetBuf,SizeOf(szRetBuf)) then
  706.         begin
  707.             hFormData := 0;
  708.              ApiDlgAccessFormData(szRetBuf);
  709.              ShowBoolResult(True,'WLAccessFormData');
  710.              OPENCLOSE_BTN.Enabled := False;
  711.         end
  712.         else
  713.             ShowBoolResult(False,'WLAccessFormData');
  714. end;
  715.  
  716. procedure TMainDlgForm.BrowserCallout;
  717. begin
  718.     case API_LIST.ItemIndex of
  719.     WLAPI_GetWindowInfo:
  720.         GetWindowInfo;
  721.     WLAPI_ListWindows:
  722.         ListWindows;
  723.     WLAPI_ActivateWindow:
  724.         ActivateWindow;
  725.     WLAPI_CloseWindow:
  726.         CloseWindow;
  727.     WLAPI_SetWindowPos:
  728.         SetWindowPos;
  729.     WLAPI_ShowWindow:
  730.         ShowWindow;
  731.     WLAPI_ShowFile:
  732.         ShowFile;
  733.     WLAPI_OpenURL:
  734.         OpenURL;
  735.     WLAPI_SaveURL:
  736.         SaveURL;
  737.     WLAPI_PostFormData:
  738.         PostFormData;
  739.     WLAPI_SaveFormData:
  740.         SaveFormData;
  741.     WLAPI_RegisterProtocol:
  742.         RegisterProtocol;
  743.     WLAPI_UnregisterProtocol:
  744.         UnregisterProtocol;
  745.     WLAPI_RegisterURLEcho:
  746.         RegisterURLEcho;
  747.     WLAPI_UnregisterURLEcho:
  748.         UnregisterURLEcho;
  749.     WLAPI_RegisterViewer:
  750.         RegisterViewer;
  751.     WLAPI_UnregisterViewer:
  752.         UnregisterViewer;
  753.     WLAPI_RegisterWindowChange:
  754.         RegisterWindowChange;
  755.     WLAPI_UnregisterWindowChange:
  756.         UnregisterWindowChange;
  757.     WLAPI_ParseAnchor:
  758.         ParseAnchor;
  759.     WLAPI_GetVersion:
  760.         GetVersion;
  761.     WLAPI_QueryURLFile:
  762.         QueryURLFile;
  763.     WLAPI_SetNotifyMethod:
  764.         SetNotifyMethod;
  765.     else
  766.         ;
  767.     end;
  768. end;
  769.  
  770. procedure TMainDlgForm.ToolbarCallout;
  771. begin
  772.     case API_LIST.ItemIndex of
  773.     WLAPI_IsToolbarActive:
  774.         IsToolbarActive;
  775.     WLAPI_SetActiveToolbar:
  776.         SetActiveToolbar;
  777.     WLAPI_AddToolbarButton:
  778.         AddToolbarButton;
  779.     WLAPI_RemoveToolbarButton:
  780.         RemoveToolbarButton;
  781.     WLAPI_IsToolbarButtonVisible:
  782.         IsToolbarButtonVisible;
  783.     WLAPI_ShowToolbarButton:
  784.         ShowToolbarButton;
  785.     WLAPI_EnableToolbarButton:
  786.         EnableToolbarButton;
  787.     WLAPI_IsToolbarButtonEnabled:
  788.         IsToolbarButtonEnabled;
  789.     WLAPI_GetToolbarText:
  790.         GetToolbarText;
  791.     WLAPI_SetToolbarText:
  792.         SetToolbarText;
  793.     WLAPI_GetToolbarFont:
  794.         GetToolbarFont;
  795.     WLAPI_SetToolbarFont:
  796.         SetToolbarFont;
  797.     WLAPI_GetToolbarBkgnd:
  798.         GetToolbarBkgnd;
  799.     WLAPI_SetToolbarBkgnd:
  800.         SetToolbarBkgnd;
  801.     WLAPI_GetToolbarTextColor:
  802.         GetToolbarTextColor;
  803.     WLAPI_SetToolbarTextColor:
  804.         SetToolbarTextColor;
  805.     else
  806.         ;
  807.     end;
  808. end;
  809.  
  810. procedure TMainDlgForm.ParserCallout;
  811. begin
  812.     case API_LIST.ItemIndex of
  813.     WLAPI_HtmlEnumParseTree:
  814.         HtmlEnumParseTree;
  815.     WLAPI_HtmlGetChild:
  816.         HtmlGetChild;
  817.     WLAPI_HtmlGetParent:
  818.         HtmlGetParent;
  819.     WLAPI_HtmlGetSibling:
  820.         HtmlGetSibling;
  821.     WLAPI_HtmlGetElementType:
  822.         HtmlGetElementType;
  823.     WLAPI_HtmlGetElementText:
  824.         HtmlGetElementText;
  825.     WLAPI_HtmlGetTextAttr:
  826.         HtmlGetTextAttr;
  827.     WLAPI_HtmlGetTagName:
  828.         HtmlGetTagName;
  829.     WLAPI_HtmlGetTagType:
  830.         HtmlGetTagType;
  831.     WLAPI_HtmlGetTagAttr:
  832.         HtmlGetTagAttr;
  833.     WLAPI_HtmlExtractTagAttr:
  834.         HtmlExtractTagAttr;
  835.     WLAPI_HtmlFindText:
  836.         HtmlFindText;
  837.     WLAPI_HtmlFindSpecial:
  838.         HtmlFindSpecial;
  839.     WLAPI_HtmlFindComment:
  840.         HtmlFindComment;
  841.     WLAPI_HtmlFindTagType:
  842.         HtmlFindTagType;
  843.     WLAPI_HtmlFindTagName:
  844.         HtmlFindTagName;
  845.     WLAPI_HtmlFindTagAttr:
  846.         HtmlFindTagAttr;
  847.     WLAPI_HtmlEnumFindText:
  848.         HtmlEnumFindText;
  849.     WLAPI_HtmlEnumFindSpecial:
  850.         HtmlEnumFindSpecial;
  851.     WLAPI_HtmlEnumFindComment:
  852.         HtmlEnumFindComment;
  853.     WLAPI_HtmlEnumFindTagType:
  854.         HtmlEnumFindTagType;
  855.     WLAPI_HtmlEnumFindTagName:
  856.         HtmlEnumFindTagName;
  857.     WLAPI_HtmlEnumFindTagAttr:
  858.         HtmlEnumFindTagAttr;
  859.     else
  860.         ;
  861.     end;
  862. end;
  863.  
  864. procedure TMainDlgForm.UtilityCallout;
  865. begin
  866.     case API_LIST.ItemIndex of
  867.     WLAPI_AppendFormData:
  868.         AppendFormData;
  869.     WLAPI_GetFormDataLength:
  870.         GetFormDataLength;
  871.     WLAPI_ParseAbsoluteURL:
  872.         ParseAbsoluteURL;
  873.     else
  874.         ;
  875.     end;
  876. end;
  877.  
  878. procedure TMainDlgForm.GetWindowInfo;
  879. var
  880.     dwWindow: LongInt;
  881.     szURL: array[0..255] of Char;
  882.     szTitle: array[0..255] of Char;
  883. begin
  884.     dwWindow := 0;
  885.     szURL[0] := Chr(0);
  886.     szTitle[0] := Chr(0);
  887.  
  888.     if ApiDlgGetWindowInfo(dwWindow) then
  889.         if WLGetWindowInfo(hBrowser,dwWindow,szURL,SizeOf(szURL),szTitle,
  890.             SizeOf(szTitle)) then
  891.             ShowStrResult2(StrPas(szURL),StrPas(szTitle),'WLGetWindowInfo')
  892.         else
  893.             ShowBoolResult(False,'WLGetWindowInfo');
  894. end;
  895.  
  896. procedure TMainDlgForm.ListWindows;
  897. var
  898.     bFirst: Bool;
  899.     dwWindow: LongInt;
  900. begin
  901.     bFirst := False;
  902.     dwWindow := 0;
  903.  
  904.     if ApiDlgListWindows(bFirst) then
  905.     begin
  906.         dwWindow := WLListWindows(hBrowser,bFirst);
  907.         if dwWindow = 0 then
  908.             ShowBoolResult(False,'WLListWindows')
  909.         else
  910.             ShowStrResult(IntToStr(dwWindow),'WLListWindows')
  911.     end;
  912. end;
  913.  
  914. procedure TMainDlgForm.ActivateWindow;
  915. var
  916.     dwWindow: LongInt;
  917. begin
  918.     dwWindow := 0;
  919.  
  920.     if ApiDlgActivateWindow(dwWindow) then
  921.     begin
  922.         dwWindow := WLActivateWindow(hBrowser,dwWindow);
  923.         if dwWindow = 0 then
  924.             ShowBoolResult(False,'WLActivateWindow')
  925.         else
  926.             ShowStrResult(IntToStr(dwWindow),'WLActivateWindow');
  927.     end
  928. end;
  929.  
  930. procedure TMainDlgForm.CloseWindow;
  931. var
  932.     dwWindow: LongInt;
  933. begin
  934.     dwWindow := 0;
  935.  
  936.     if ApiDlgCloseWindow(dwWindow) then
  937.         if WLCloseWindow(hBrowser,dwWindow) then
  938.             ShowBoolResult(True,'WLCloseWindow')
  939.         else
  940.             ShowBoolResult(False,'WLCloseWindow');
  941. end;
  942.  
  943. procedure TMainDlgForm.SetWindowPos;
  944. var
  945.     dwWindow: LongInt;
  946.     dwX: LongInt;
  947.     dwY: LongInt;
  948.     dwWidth: LongInt;
  949.     dwHeight: LongInt;
  950. begin
  951.     dwWindow := 0;
  952.     dwX := 0;
  953.     dwY := 0;
  954.     dwWidth := 0;
  955.     dwHeight := 0;
  956.  
  957.     if ApiDlgSetWindowPos(dwWindow,dwX,dwY,dwWidth,dwHeight) then
  958.         if WLSetWindowPos(hBrowser,dwWindow,dwX,dwY,dwWidth,dwHeight) then
  959.             ShowBoolResult(True,'WLSetWindowPos')
  960.         else
  961.             ShowBoolResult(False,'WLSetWindowPos');
  962. end;
  963.  
  964. procedure TMainDlgForm.ShowWindow;
  965. var
  966.     dwWindow: LongInt;
  967.     nShow : Word;
  968. begin
  969.     dwWindow := 0;
  970.     nShow := WL_NORMAL;
  971.  
  972.     if ApiDlgShowWindow(dwWindow,nShow) then
  973.         if WLShowWindow(hBrowser,dwWindow,nShow) then
  974.             ShowBoolResult(True,'WLShowWindow')
  975.         else
  976.             ShowBoolResult(False,'WLShowWindow');
  977. end;
  978.  
  979. procedure TMainDlgForm.ShowFile;
  980. var
  981.     szFile: array[0..255] of Char;
  982.     szMIME: array[0..63] of Char;
  983.     bNotify: Bool;
  984.     szURL: array[0..255] of Char;
  985.     dwWindow: LongInt;
  986.     dwTrx: LongInt;
  987.     hwndNotify: HWnd;
  988. begin
  989.     szFile[0] := Chr(0);
  990.     szMIME[0] := Chr(0);
  991.     szURL[0] := Chr(0);
  992.     bNotify := True;
  993.     dwWindow := 0;
  994.     dwTrx := 0;
  995.     hwndNotify := WL_NONOTIFY;
  996.  
  997.     if ApiDlgShowFile(szFile,SizeOf(szFile),szMIME,SizeOf(szMIME),bNotify,szURL,
  998.         SizeOf(szURL),dwWindow) then
  999.     begin
  1000.         if (bNotify) then
  1001.             hwndNotify := Handle;
  1002.         dwTrx := WLShowFile(hBrowser,szFile,szMIME,dwWindow,szURL,hwndNotify,
  1003.             WM_WEBLIB_NOTIFY);
  1004.         if dwTrx = 0 then
  1005.             ShowBoolResult(False,'WLShowFile')
  1006.         else
  1007.             ShowStrResult(IntToStr(dwTrx),'WLShowFile');
  1008.     end;
  1009. end;
  1010.  
  1011. procedure TMainDlgForm.OpenURL;
  1012. var
  1013.     szURL: array[0..255] of Char;
  1014.     bNotify: Bool;
  1015.     bBackground: Bool;
  1016.     bNoDocCache: Bool;
  1017.     bNoImageCache: Bool;
  1018.     dwWindow: LongInt;
  1019.     wOptions: Word;
  1020.     dwTrx: LongInt;
  1021.     hwndNotify: HWnd;
  1022. begin
  1023.     szURL[0] := Chr(0);
  1024.     bNotify := True;
  1025.     dwWindow := 0;
  1026.     bBackground := False;
  1027.     bNoDocCache := False;
  1028.     bNoImageCache := False;
  1029.     dwTrx := 0;
  1030.     hwndNotify := WL_NONOTIFY;
  1031.  
  1032.     wOptions := 0;
  1033.     if bBackground then
  1034.         wOptions := wOptions or WL_BACKGROUNDMODE;
  1035.     if bNoDocCache then
  1036.         wOptions := wOptions or WL_NODOCUMENTCACHE;
  1037.     if bNoImageCache then
  1038.         wOptions := wOptions or WL_NOIMAGECACHE;
  1039.  
  1040.     if ApiDlgOpenURL(bBackground,bNoDocCache,bNoImageCache,bNotify,szURL,SizeOf(szURL),
  1041.         dwWindow) then
  1042.     begin
  1043.         if (bNotify) then
  1044.             hwndNotify := Handle;
  1045.         dwTrx := WLOpenURL(hBrowser,szURL,dwWindow,wOptions,hwndNotify,
  1046.             WM_WEBLIB_NOTIFY);
  1047.         if dwTrx = 0 then
  1048.             ShowBoolResult(False,'WLOpenURL')
  1049.         else
  1050.             ShowStrResult(IntToStr(dwTrx),'WLOpenURL');
  1051.     end;
  1052. end;
  1053.  
  1054. procedure TMainDlgForm.SaveURL;
  1055. var
  1056.     szFile: array[0..255] of Char;
  1057.     szURL: array[0..255] of Char;
  1058.     bNotify: Bool;
  1059.     bBackground: Bool;
  1060.     bNoDocCache: Bool;
  1061.     bNoImageCache: Bool;
  1062.     dwWindow: LongInt;
  1063.     wOptions: Word;
  1064.     dwTrx: LongInt;
  1065.     hwndNotify: HWnd;
  1066. begin
  1067.     szURL[0] := Chr(0);
  1068.     szFile[0] := Chr(0);
  1069.     bNotify := True;
  1070.     dwWindow := 0;
  1071.     bBackground := False;
  1072.     bNoDocCache := False;
  1073.     bNoImageCache := False;
  1074.     dwTrx := 0;
  1075.     hwndNotify := WL_NONOTIFY;
  1076.  
  1077.     wOptions := 0;
  1078.     if bBackground then
  1079.         wOptions := wOptions or WL_BACKGROUNDMODE;
  1080.     if bNoDocCache then
  1081.         wOptions := wOptions or WL_NODOCUMENTCACHE;
  1082.     if bNoImageCache then
  1083.         wOptions := wOptions or WL_NOIMAGECACHE;
  1084.  
  1085.     if ApiDlgSaveURL(bBackground,bNoDocCache,bNoImageCache,bNotify,szURL,SizeOf(szURL),
  1086.         szFile,SizeOf(szFile),dwWindow) then
  1087.     begin
  1088.         if (bNotify) then
  1089.             hwndNotify := Handle;
  1090.         dwTrx := WLSaveURL(hBrowser,szURL,szFile,dwWindow,wOptions,hwndNotify,
  1091.             WM_WEBLIB_NOTIFY);
  1092.         if dwTrx = 0 then
  1093.             ShowBoolResult(False,'WLSaveURL')
  1094.         else
  1095.             ShowStrResult(IntToStr(dwTrx),'WLSaveURL');
  1096.     end;
  1097. end;
  1098.  
  1099. procedure TMainDlgForm.PostFormData;
  1100. var
  1101.     szFormData: array[0..1023] of Char;
  1102.     szMIME: array[0..63] of Char;
  1103.     szURL: array[0..255] of Char;
  1104.     bNotify: Bool;
  1105.     dwWindow: LongInt;
  1106.     dwTrx: LongInt;
  1107.     hwndNotify: HWnd;
  1108. begin
  1109.     szFormData[0] := Chr(0);
  1110.     szMIME[0] := Chr(0);
  1111.     szURL[0] := Chr(0);
  1112.     bNotify := True;
  1113.     dwWindow := 0;
  1114.     dwTrx := 0;
  1115.     hwndNotify := WL_NONOTIFY;
  1116.  
  1117.     if ApiDlgPostFormData(szFormData,SizeOf(szFormData),szMIME,SizeOf(szMIME),
  1118.         bNotify,szURL,SizeOf(szURL),dwWindow) then
  1119.     begin
  1120.         if (bNotify) then
  1121.             hwndNotify := Handle;
  1122.         dwTrx := WLPostFormData(hBrowser,szURL,dwWindow,szFormData,szMIME,
  1123.             hwndNotify,WM_WEBLIB_NOTIFY);
  1124.         if dwTrx = 0 then
  1125.             ShowBoolResult(False,'WLPostFormData')
  1126.         else
  1127.             ShowStrResult(IntToStr(dwTrx),'WLPostFormData');
  1128.     end;
  1129. end;
  1130.  
  1131. procedure TMainDlgForm.SaveFormData;
  1132. var
  1133.     szFormData: array[0..1023] of Char;
  1134.     szMIME: array[0..63] of Char;
  1135.     szURL: array[0..255] of Char;
  1136.     szFile: array[0..255] of Char;
  1137.     bNotify: Bool;
  1138.     dwWindow: LongInt;
  1139.     dwTrx: LongInt;
  1140.     hwndNotify: HWnd;
  1141. begin
  1142.     szFormData[0] := Chr(0);
  1143.     szMIME[0] := Chr(0);
  1144.     szURL[0] := Chr(0);
  1145.     szFile[0] := Chr(0);
  1146.     bNotify := True;
  1147.     dwWindow := 0;
  1148.     dwTrx := 0;
  1149.     hwndNotify := WL_NONOTIFY;
  1150.  
  1151.     if ApiDlgSaveFormData(szFile,SizeOf(szFile),szFormData,SizeOf(szFormData),
  1152.         szMIME,SizeOf(szMIME),bNotify,szURL,SizeOf(szURL),dwWindow) then
  1153.     begin
  1154.         if (bNotify) then
  1155.             hwndNotify := Handle;
  1156.         dwTrx := WLSaveFormData(hBrowser,szURL,szFile,dwWindow,szFormData,szMIME,
  1157.             hwndNotify,WM_WEBLIB_NOTIFY);
  1158.         if dwTrx = 0 then
  1159.             ShowBoolResult(False,'WLSaveFormData')
  1160.         else
  1161.             ShowStrResult(IntToStr(dwTrx),'WLSaveFormData');
  1162.     end;
  1163. end;
  1164.  
  1165. procedure TMainDlgForm.RegisterProtocol;
  1166. var
  1167.     szProtocol: array[0..64] of Char;
  1168. begin
  1169.     szProtocol[0] := Chr(0);
  1170.  
  1171.     if ApiDlgRegisterProtocol(szProtocol,SizeOf(szProtocol)) then
  1172.         if WLRegisterProtocol(hBrowser,szProtocol,Handle,WM_WEBLIB_NOTIFY) then
  1173.         begin
  1174.             staRegProtocol.Add(StrPas(szProtocol));
  1175.             ShowBoolResult(True,'WLRegisterProtocol')
  1176.         end
  1177.         else
  1178.             ShowBoolResult(False,'WLRegisterProtocol');
  1179. end;
  1180.  
  1181. procedure TMainDlgForm.UnregisterProtocol;
  1182. var
  1183.     szProtocol: array[0..64] of Char;
  1184.     nIdx: Integer;
  1185. begin
  1186.     szProtocol[0] := Chr(0);
  1187.  
  1188.     if ApiDlgUnregisterProtocol(szProtocol,SizeOf(szProtocol)) then
  1189.         if WLUnregisterProtocol(hBrowser,szProtocol,Handle) then
  1190.         begin
  1191.             nIdx := staRegProtocol.IndexOf(StrPas(szProtocol));
  1192.              if nIdx >= 0 then
  1193.                     staRegProtocol.Delete(nIdx);
  1194.             ShowBoolResult(True,'WLUnregisterProtocol');
  1195.         end
  1196.         else
  1197.             ShowBoolResult(False,'WLUnregisterProtocol');
  1198. end;
  1199.  
  1200. procedure TMainDlgForm.RegisterURLEcho;
  1201. begin
  1202.     if WLRegisterURLEcho(hBrowser,Handle,WM_WEBLIB_NOTIFY) then
  1203.     begin
  1204.         staRegURLEcho := True;
  1205.         ShowBoolResult(True,'WLRegisterURLEcho');
  1206.     end
  1207.     else
  1208.         ShowBoolResult(False,'WLRegisterURLEcho');
  1209. end;
  1210.  
  1211. procedure TMainDlgForm.UnregisterURLEcho;
  1212. begin
  1213.     if WLUnregisterURLEcho(hBrowser,Handle) then
  1214.     begin
  1215.         staRegURLEcho := False;
  1216.         ShowBoolResult(True,'WLUnregisterURLEcho');
  1217.     end
  1218.     else
  1219.         ShowBoolResult(False,'WLUnregisterURLEcho');
  1220. end;
  1221.  
  1222. procedure TMainDlgForm.RegisterViewer;
  1223. var
  1224.     szMIME: array[0..63] of Char;
  1225.     bQueryViewer: Bool;
  1226.     bShellExec: Bool;
  1227.     bViewDocFile: Bool;
  1228.     wOptions: Word;
  1229. begin
  1230.     szMIME[0] := Chr(0);
  1231.     bQueryViewer := False;
  1232.     bShellExec := False;
  1233.     bViewDocFile := True;
  1234.  
  1235.     if ApiDlgRegisterViewer(szMIME,SizeOf(szMIME),bQueryViewer,bShellExec,
  1236.         bViewDocFile) then
  1237.     begin
  1238.         wOptions := 0;
  1239.         if bQueryViewer then
  1240.             wOptions := wOptions or WL_QUERYVIEWER;
  1241.         if bShellExec then
  1242.             wOptions := wOptions or WL_SHELLEXECUTE;
  1243.         if bViewDocFile then
  1244.             wOptions := wOptions or WL_VIEWDOCFILE;
  1245.  
  1246.         if WLRegisterViewer(hBrowser,szMIME,wOptions,Handle,WM_WEBLIB_NOTIFY) then
  1247.         begin
  1248.             staRegViewer.Add(StrPas(szMIME));
  1249.             ShowBoolResult(True,'WLRegisterViewer')
  1250.         end
  1251.         else
  1252.             ShowBoolResult(False,'WLRegisterViewer');
  1253.     end;
  1254. end;
  1255.  
  1256. procedure TMainDlgForm.UnregisterViewer;
  1257. var
  1258.     szMIME: array[0..63] of Char;
  1259.     nIdx: Integer;
  1260. begin
  1261.     szMIME[0] := Chr(0);
  1262.  
  1263.     if ApiDlgUnregisterViewer(szMIME,SizeOf(szMIME)) then
  1264.         if WLUnregisterViewer(hBrowser,szMIME,Handle) then
  1265.         begin
  1266.             nIdx := staRegViewer.IndexOf(StrPas(szMIME));
  1267.              if nIdx >= 0 then
  1268.                     staRegViewer.Delete(nIdx);
  1269.             ShowBoolResult(True,'WLUnregisterViewer');
  1270.         end
  1271.         else
  1272.             ShowBoolResult(False,'WLUnregisterViewer');
  1273. end;
  1274.  
  1275. procedure TMainDlgForm.RegisterWindowChange;
  1276. var
  1277.     dwWindow: LongInt;
  1278. begin
  1279.     dwWindow := 0;
  1280.  
  1281.     if ApiDlgRegisterWindowChange(dwWindow) then
  1282.         if WLRegisterWindowChange(hBrowser,dwWindow,Handle,WM_WEBLIB_NOTIFY) then
  1283.         begin
  1284.             staRegWindowChange.Add(IntToStr(dwWindow));
  1285.             ShowBoolResult(True,'WLRegisterWindowChange');
  1286.         end
  1287.         else
  1288.             ShowBoolResult(False,'WLRegisterWindowChange');
  1289. end;
  1290.  
  1291. procedure TMainDlgForm.UnregisterWindowChange;
  1292. var
  1293.     dwWindow: LongInt;
  1294.     nIdx: Integer;
  1295. begin
  1296.     dwWindow := 0;
  1297.  
  1298.     if ApiDlgUnregisterWindowChange(dwWindow) then
  1299.         if WLUnregisterWindowChange(hBrowser,dwWindow,Handle) then
  1300.         begin
  1301.             nIdx := staRegWindowChange.IndexOf(IntToStr(dwWindow));
  1302.              if nIdx >= 0 then
  1303.                     staRegWindowChange.Delete(nIdx);
  1304.             ShowBoolResult(True,'WLUnregisterWindowChange');
  1305.         end
  1306.         else
  1307.             ShowBoolResult(False,'WLUnregisterWindowChange');
  1308. end;
  1309.  
  1310. procedure TMainDlgForm.ParseAnchor;
  1311. var
  1312.     szAbsURL: array[0..255] of Char;
  1313.     szRelURL: array[0..255] of Char;
  1314.     pszURL: PChar;
  1315. begin
  1316.     szAbsURL[0] := Chr(0);
  1317.     szRelURL[0] := Chr(0);
  1318.     pszURL := Nil;
  1319.  
  1320.     if ApiDlgParseAnchor(szAbsURL,SizeOf(szAbsURL),szRelURL,SizeOf(szRelURL)) then
  1321.     begin
  1322.         pszURL := WLParseAnchor(hBrowser,szAbsURL,szRelURL);
  1323.         if (pszURL = Nil) then
  1324.             ShowBoolResult(False,'WLParseAnchor')
  1325.         else
  1326.             ShowStrResult(StrPas(pszURL),'WLParseAnchor');
  1327.     end;
  1328. end;
  1329.  
  1330. procedure TMainDlgForm.GetVersion;
  1331. var
  1332.     nMajor: Word;
  1333.     nMinor: Word;
  1334.     dwVersion: LongInt;
  1335. begin
  1336.     nMajor := 0;
  1337.     nMinor := 0;
  1338.     dwVersion := 0;
  1339.  
  1340.     if ApiDlgGetVersion(nMajor,nMinor) then
  1341.     begin
  1342.         dwVersion := WLGetVersion(hBrowser,nMajor,nMinor);
  1343.         nMinor := dwVersion and $FFFF;
  1344.         nMajor := dwVersion shr 16;
  1345.         ShowStrResult2(IntToStr(nMajor),IntToStr(nMinor),'WLGetVersion');
  1346.     end;
  1347. end;
  1348.  
  1349. procedure TMainDlgForm.QueryURLFile;
  1350. var
  1351.     szFile: array[0..255] of Char;
  1352.     pszURL: PChar;
  1353. begin
  1354.     szFile[0] := Chr(0);
  1355.     pszURL := Nil;
  1356.  
  1357.     if ApiDlgQueryFile(szFile,SizeOf(szFile)) then
  1358.     begin
  1359.         pszURL := WLQueryURLFile(hBrowser,szFile);
  1360.         if pszURL = Nil then
  1361.             ShowBoolResult(False,'WLQueryURLFile')
  1362.         else
  1363.             ShowStrResult(StrPas(pszURL),'WLQueryURLFile');
  1364.     end;
  1365. end;
  1366.  
  1367. procedure TMainDlgForm.SetNotifyMethod;
  1368. var
  1369.     bPost: Bool;
  1370.     wMethod: Word;
  1371. begin
  1372.     bPost := True;
  1373.  
  1374.     if ApiDlgSetNotifyMethod(bPost) then
  1375.         if bPost then
  1376.             wMethod := WL_POSTMESSAGE
  1377.         else
  1378.             wMethod := WL_SENDMESSAGE;
  1379.  
  1380.         if WLSetNotifyMethod(hBrowser,wMethod) then
  1381.             ShowBoolResult(True,'WLSetNotifyMethod')
  1382.         else
  1383.              ShowBoolResult(False,'WLSetNotifyMethod');
  1384. end;
  1385.  
  1386. procedure TMainDlgForm.IsToolbarActive;
  1387. begin
  1388.     if WLIsToolbarActive(hToolbar) then
  1389.         ShowBoolResult(True,'WLIsToolbarActive')
  1390.     else
  1391.         ShowBoolResult(False,'WLIsToolbarActive');
  1392. end;
  1393.  
  1394. procedure TMainDlgForm.SetActiveToolbar;
  1395. begin
  1396.     if WLSetActiveToolbar(hToolbar) then
  1397.         ShowBoolResult(True,'WLSetActiveToolbar')
  1398.     else
  1399.         ShowBoolResult(False,'WLSetActiveToolbar');
  1400. end;
  1401.  
  1402. procedure TMainDlgForm.AddToolbarButton;
  1403. var
  1404.     nID: Word;
  1405.     nIdx: Integer;
  1406.     szText: array[0..64] of Char;
  1407.     nBitmapStyle: Integer;
  1408.     nBitmapMask: Integer;
  1409.     hDLLInst: THandle;
  1410.     nBitmap: Word;
  1411.     nBitmapSel: Word;
  1412.     nBitmapFocus: Word;
  1413.     nBitmapDisabled: Word;
  1414. begin
  1415.     nID := 100;
  1416.     nIdx := 0;
  1417.     szText[0] := Chr(0);
  1418.     nBitmapStyle := 1;
  1419.     nBitmapMask := $F;
  1420.  
  1421.     if ApiDlgAddToolbarButton(nID,nIdx,szText,SizeOf(szText),nBitmapStyle,
  1422.         nBitmapMask) then
  1423.     begin
  1424.         hDLLInst := GetApiDlgDLLInstance;
  1425.         nBitmap := 0;
  1426.         nBitmapSel := 0;
  1427.         nBitmapFocus := 0;
  1428.         nBitmapDisabled := 0;
  1429.  
  1430.         if (nBitmapMask and BM_UP) = BM_UP then
  1431.             nBitmap := nBitmapStyle + APIDLG_BITMAP_UP;
  1432.         if (nBitmapMask and BM_SEL) = BM_SEL then
  1433.             nBitmapSel := nBitmapStyle + APIDLG_BITMAP_SEL;
  1434.         if (nBitmapMask and BM_FOCUS) = BM_FOCUS then
  1435.             nBitmapFocus := nBitmapStyle + APIDLG_BITMAP_FOCUS;
  1436.         if (nBitmapMask and BM_DISABLED) = BM_DISABLED then
  1437.             nBitmapDisabled := nBitmapStyle + APIDLG_BITMAP_DISABLED;
  1438.  
  1439.         if WLAddToolbarButtonByID(hToolbar,nID,nIdx,szText,hDLLInst,nBitmap,
  1440.             nBitmapSel,nBitmapFocus,nBitmapDisabled) then
  1441.         begin
  1442.              staToolbar.Add(IntToStr(nID));
  1443.             ShowBoolResult(True,'WLAddToolbarButtonByID');
  1444.         end
  1445.         else
  1446.             ShowBoolResult(False,'WLAddToolbarButtonByID');
  1447.     end;
  1448. end;
  1449.  
  1450. procedure TMainDlgForm.RemoveToolbarButton;
  1451. var
  1452.     nID: Word;
  1453.     nIdx: Integer;
  1454. begin
  1455.     nID := 100;
  1456.     if ApiDlgRemoveToolbarButton(nID) then
  1457.         if WLRemoveToolbarButton(hToolbar,nID) then
  1458.         begin
  1459.             nIdx := staToolbar.IndexOf(IntToStr(nID));
  1460.              if nIdx >= 0 then
  1461.                     staToolbar.Delete(nIdx);
  1462.             ShowBoolResult(True,'WLRemoveToolbarButton');
  1463.         end
  1464.         else
  1465.             ShowBoolResult(False,'WLRemoveToolbarButton');
  1466. end;
  1467.  
  1468. procedure TMainDlgForm.IsToolbarButtonVisible;
  1469. var
  1470.     nID: Word;
  1471. begin
  1472.     nID := 100;
  1473.  
  1474.     if ApiDlgIsToolbarButtonVisible(nID) then
  1475.         if WLIsToolbarButtonVisible(hToolbar,nID) then
  1476.             ShowBoolResult(True,'WLIsToolbarButtonVisible')
  1477.         else
  1478.             ShowBoolResult(False,'WLIsToolbarButtonVisible');
  1479. end;
  1480.  
  1481. procedure TMainDlgForm.ShowToolbarButton;
  1482. var
  1483.     nID: Word;
  1484.     bShow: Bool;
  1485. begin
  1486.     nID := 100;
  1487.     bShow := True;
  1488.  
  1489.     if ApiDlgShowToolbarButton(nID,bShow) then
  1490.         if WLShowToolbarButton(hToolbar,nID,bShow) then
  1491.             ShowBoolResult(True,'WLShowToolbarButton')
  1492.         else
  1493.             ShowBoolResult(False,'WLShowToolbarButton');
  1494. end;
  1495.  
  1496. procedure TMainDlgForm.EnableToolbarButton;
  1497. var
  1498.     nID: Word;
  1499.     bEnable: Bool;
  1500. begin
  1501.     nID := 100;
  1502.     bEnable := True;
  1503.  
  1504.     if ApiDlgEnableToolbarButton(nID,bEnable) then
  1505.         if WLEnableToolbarButton(hToolbar,nID,bEnable) then
  1506.             ShowBoolResult(True,'WLEnableToolbarButton')
  1507.         else
  1508.             ShowBoolResult(False,'WLEnableToolbarButton');
  1509. end;
  1510.  
  1511. procedure TMainDlgForm.IsToolbarButtonEnabled;
  1512. var
  1513.     nID: Word;
  1514. begin
  1515.     nID := 100;
  1516.  
  1517.     if ApiDlgIsToolbarButtonEnabled(nID) then
  1518.         if WLIsToolbarButtonEnabled(hToolbar,nID) then
  1519.             ShowBoolResult(True,'WLIsToolbarButtonEnabled')
  1520.         else
  1521.             ShowBoolResult(False,'WLIsToolbarButtonEnabled');
  1522. end;
  1523.  
  1524. procedure TMainDlgForm.GetToolbarText;
  1525. var
  1526.     nID: Word;
  1527.     pszText: PChar;
  1528.     nTemp: Integer;
  1529. begin
  1530.     nID := 0;
  1531.     pszText := Nil;
  1532.  
  1533.     if ApiDlgGetToolbarText(nID) then
  1534.     begin
  1535.         if nID = 0 then
  1536.         begin
  1537.             nTemp := WL_TOOLBARTEXT;    { quick and dirty to shutup compiler }
  1538.             nID := nTemp;
  1539.         end;
  1540.  
  1541.         pszText := WLGetToolbarText(hToolbar,nID);
  1542.         if pszText = Nil then
  1543.             ShowBoolResult(False,'WLGetToolbarText')
  1544.         else
  1545.             ShowStrResult(StrPas(pszText),'WLGetToolbarText');
  1546.     end;
  1547. end;
  1548.  
  1549. procedure TMainDlgForm.SetToolbarText;
  1550. var
  1551.     nID: Word;
  1552.     nTemp: Integer;
  1553.     szText: array[0..127] of Char;
  1554. begin
  1555.     nID := 0;
  1556.     szText[0] := Chr(0);
  1557.  
  1558.     if ApiDlgSetToolbarText(nID,szText,SizeOf(szText)) then
  1559.     begin
  1560.         if nID = 0 then
  1561.         begin
  1562.             nTemp := WL_TOOLBARTEXT;    { quick and dirty to shutup compiler }
  1563.             nID := nTemp;
  1564.         end;
  1565.  
  1566.         if WLSetToolbarText(hToolbar,nID,szText) then
  1567.              ShowBoolResult(True,'WLSetToolbarText')
  1568.         else
  1569.             ShowBoolResult(False,'WLSetToolbarText');
  1570.     end;
  1571. end;
  1572.  
  1573. procedure TMainDlgForm.GetToolbarFont;
  1574. var
  1575.        bToolbar: Bool;
  1576.     wType: Word;
  1577.     szFont: array[0..63] of Char;
  1578.     nPointSize: Integer;
  1579.     hfontRet: HFont;
  1580. begin
  1581.     bToolbar := False;
  1582.  
  1583.     if ApiDlgGetToolbarFont(bToolbar) then
  1584.     begin
  1585.         if bToolbar then
  1586.             wType := WL_TOOLBARFONT
  1587.         else
  1588.             wType := WL_BUTTONFONT;
  1589.  
  1590.         hfontRet := WLGetToolbarFont(hToolbar,wType);
  1591.         if hfontRet = 0 then
  1592.             ShowBoolResult(False,'WLGetToolbarFont')
  1593.         else
  1594.         begin
  1595.             szFont[0] := Chr(0);
  1596.              nPointSize := 0;
  1597.  
  1598.             ApiDlgGetFontInfo4GL(hfontRet,szFont,SizeOf(szFont),nPointSize);
  1599.             ShowStrResult2(IntToStr(nPointSize),StrPas(szFont),'WLGetToolbarFont');
  1600.         end;
  1601.     end;
  1602. end;
  1603.  
  1604. procedure TMainDlgForm.SetToolbarFont;
  1605. var
  1606.     szFont: array[0..63] of Char;
  1607.        nPointSize: Integer;
  1608.        bToolbar: Bool;
  1609.     wType: Word;
  1610.     hfontNew: HFont;
  1611. begin
  1612.     szFont[0] := Chr(0);
  1613.     nPointSize := 0;
  1614.     bToolbar := False;
  1615.  
  1616.     if ApiDlgSetToolbarFont(szFont,SizeOf(szFont),nPointSize,bToolbar) then
  1617.     begin
  1618.         hfontNew := ApiDlgCreateFont4GL(szFont,nPointSize);
  1619.  
  1620.         if bToolbar then
  1621.         begin
  1622.             wType := WL_TOOLBARFONT;
  1623.              if hfontToolbar <> 0 then
  1624.                  ApiDlgFreeFont4GL(hfontToolbar);
  1625.                 hfontToolbar := hfontNew;
  1626.         end
  1627.         else
  1628.         begin
  1629.             wType := WL_BUTTONFONT;
  1630.              if hfontButton <> 0 then
  1631.                  ApiDlgFreeFont4GL(hfontButton);
  1632.              hfontButton := hfontNew;
  1633.         end;
  1634.  
  1635.         if WLSetToolbarFont(hToolbar,wType,hfontNew) then
  1636.              ShowBoolResult(True,'WLSetToolbarFont')
  1637.         else
  1638.             ShowBoolResult(False,'WLSetToolbarFont');
  1639.     end;
  1640. end;
  1641.  
  1642. procedure TMainDlgForm.GetToolbarBkgnd;
  1643. var
  1644.     crBkgnd: TColorRef;
  1645. begin
  1646.     crBkgnd := WLGetToolbarBkgnd(hToolbar);
  1647.     ShowStrResult(IntToHex(crBkgnd,8),'WLGetToolbarBkgnd');
  1648. end;
  1649.  
  1650. procedure TMainDlgForm.SetToolbarBkgnd;
  1651. var
  1652.     nRed: Integer;
  1653.     nGreen: Integer;
  1654.     nBlue: Integer;
  1655.     crBkgnd: TColorRef;
  1656. begin
  1657.     nRed := 0;
  1658.     nGreen := 0;
  1659.     nBlue := 0;
  1660.  
  1661.     if ApiDlgSetToolbarBkgnd(nRed,nGreen,nBlue) then
  1662.     begin
  1663.         crBkgnd := RGB(nRed,nGreen,nBlue);
  1664.         if WLSetToolbarBkgnd(hToolbar,crBkgnd) then
  1665.             ShowBoolResult(True,'WLSetToolbarBkgnd')
  1666.         else
  1667.             ShowBoolResult(False,'WLSetToolbarBkgnd');
  1668.     end;
  1669. end;
  1670.  
  1671. procedure TMainDlgForm.GetToolbarTextColor;
  1672. var
  1673.     bToolbar: Bool;
  1674.     wType: Word;
  1675.     crText: TColorRef;
  1676. begin
  1677.     bToolbar := False;
  1678.  
  1679.     if ApiDlgGetToolbarTextColor(bToolbar) then
  1680.     begin
  1681.         if bToolbar then
  1682.             wType := WL_TOOLBARTEXTCOLOR
  1683.         else
  1684.             wType := WL_BUTTONTEXTCOLOR;
  1685.  
  1686.         crText := WLGetToolbarTextColor(hToolbar,wType);
  1687.         ShowStrResult(IntToHex(crText,8),'WLGetToolbarTextColor');
  1688.     end;
  1689. end;
  1690.  
  1691. procedure TMainDlgForm.SetToolbarTextColor;
  1692. var
  1693.     bToolbar: Bool;
  1694.     nRed: Integer;
  1695.     nGreen: Integer;
  1696.     nBlue: Integer;
  1697.     wType: Word;
  1698.     crText: TColorRef;
  1699. begin
  1700.     bToolbar := False;
  1701.     nRed := 0;
  1702.     nGreen := 0;
  1703.     nBlue := 0;
  1704.  
  1705.     if ApiDlgSetToolbarTextColor(nRed,nGreen,nBlue,bToolbar) then
  1706.     begin
  1707.         if bToolbar then
  1708.             wType := WL_TOOLBARTEXTCOLOR
  1709.         else
  1710.             wType := WL_BUTTONTEXTCOLOR;
  1711.         crText := RGB(nRed,nGreen,nBlue);
  1712.  
  1713.         if WLSetToolbarTextColor(hToolbar,wType,crText) then
  1714.             ShowBoolResult(True,'WLSetToolbarTextColor')
  1715.         else
  1716.             ShowBoolResult(False,'WLSetToolbarTextColor');
  1717.     end;
  1718.  
  1719. end;
  1720.  
  1721. procedure TMainDlgForm.HtmlEnumParseTree;
  1722. begin
  1723.     if WLHtmlEnumParseTree(hParse,Handle,WM_WEBLIB_ENUMPARSETREE) then
  1724.         ShowBoolResult(True,'WLHtmlEnumParseTree')
  1725.     else
  1726.         ShowBoolResult(False,'WLHtmlEnumParseTree');
  1727. end;
  1728.  
  1729. procedure TMainDlgForm.HtmlGetChild;
  1730. var
  1731.     hElement: Htmlpars.HELEMENT;
  1732. begin
  1733.     hElement := WLHtmlGetChild(hParse,hCurrElement);
  1734.  
  1735.     if hElement = 0 then
  1736.         ShowBoolResult(False,'WLHtmlGetChild')
  1737.     else
  1738.     begin
  1739.         hCurrElement := hElement;
  1740.         hCurrTagAttr := 0;
  1741.         ShowBoolResult(True,'WLHtmlGetChild');
  1742.     end;
  1743. end;
  1744.  
  1745. procedure TMainDlgForm.HtmlGetParent;
  1746. var
  1747.     hElement: Htmlpars.HELEMENT;
  1748. begin
  1749.     hElement := WLHtmlGetParent(hParse,hCurrElement);
  1750.  
  1751.     if hElement = 0 then
  1752.         ShowBoolResult(False,'WLHtmlGetParent')
  1753.     else
  1754.     begin
  1755.         hCurrElement := hElement;
  1756.         hCurrTagAttr := 0;
  1757.         ShowBoolResult(True,'WLHtmlGetParent');
  1758.     end;
  1759. end;
  1760.  
  1761. procedure TMainDlgForm.HtmlGetSibling;
  1762. var
  1763.     hElement: Htmlpars.HELEMENT;
  1764.     nRel: Word;
  1765. begin
  1766.     nRel := WL_FIRSTELEM;
  1767.  
  1768.     if ApiDlgHtmlGetSibling(nRel) then
  1769.     begin
  1770.         hElement := WLHtmlGetSibling(hParse,hCurrElement,nRel);
  1771.  
  1772.         if hElement = 0 then
  1773.             ShowBoolResult(False,'WLHtmlGetSibling')
  1774.         else
  1775.         begin
  1776.             hCurrElement := hElement;
  1777.             hCurrTagAttr := 0;
  1778.             ShowBoolResult(True,'WLHtmlGetSibling');
  1779.         end;
  1780.     end;
  1781. end;
  1782.  
  1783. procedure TMainDlgForm.HtmlGetElementType;
  1784. var
  1785.     wType: Word;
  1786.     szType: string;
  1787. begin
  1788.     wType := WLHtmlGetElementType(hParse,hCurrElement);
  1789.  
  1790.     case wType of
  1791.     WL_ROOT:
  1792.         szType := 'ROOT';
  1793.     WL_TAG:
  1794.         szType := 'TAG';
  1795.     WL_TEXT:
  1796.         szType := 'TEXT';
  1797.     WL_SPECIALCHAR:
  1798.         szType := 'SPECIALCHAR';
  1799.     WL_COMMENT:
  1800.         szType := 'COMMENT';
  1801.     else
  1802.         szType := '???';
  1803.     end;
  1804.  
  1805.     ShowStrResult(szType,'WLHtmlGetElementType');
  1806. end;
  1807.  
  1808. procedure TMainDlgForm.HtmlGetElementText;
  1809. var
  1810.     pszText: PChar;
  1811. begin
  1812.     pszText := WLHtmlGetElementText(hParse,hCurrElement);
  1813.     if pszText = Nil then
  1814.         ShowBoolResult(False,'WLHtmlGetElementText')
  1815.     else
  1816.          ShowStrResult(StrPas(pszText),'WLHtmlGetElementText');
  1817. end;
  1818.  
  1819. procedure TMainDlgForm.HtmlGetTextAttr;
  1820. var
  1821.     lTextAttr: LongInt;
  1822. begin
  1823.     lTextAttr := WLHtmlGetTextAttr(hParse,hCurrElement);
  1824.     ShowStrResult(IntToHex(lTextAttr,8),'WLHtmlGetTextAttr');
  1825. end;
  1826.  
  1827. procedure TMainDlgForm.HtmlGetTagName;
  1828. var
  1829.     pszTag: PChar;
  1830. begin
  1831.     pszTag := WLHtmlGetTagName(hParse,hCurrElement);
  1832.     ShowStrResult(StrPas(pszTag),'WLHtmlGetTagName');
  1833. end;
  1834.  
  1835. procedure TMainDlgForm.HtmlGetTagType;
  1836. var
  1837.     wType : Word;
  1838. begin
  1839.     wType := WLHtmlGetTagType(hParse,hCurrElement);
  1840.     ShowStrResult(IntToStr(wType),'WLHtmlGetTagName');
  1841. end;
  1842.  
  1843. procedure TMainDlgForm.HtmlGetTagAttr;
  1844. var
  1845.     wType: Word;
  1846.     szAttr: array[0..63] of Char;
  1847.     szValue: array[0..255] of Char;
  1848.     szMsg: String;
  1849. begin
  1850.     wType := 0;
  1851.     szAttr[0] := Chr(0);
  1852.     szValue[0] := Chr(0);
  1853.  
  1854.     hCurrTagAttr := WLHtmlGetTagAttr(hParse,hCurrElement,hCurrTagAttr,wType,
  1855.         szAttr,SizeOf(szAttr),szValue,SizeOf(szValue));
  1856.     szMsg := 'TYPE: ' +
  1857.         IntToStr(wType) + ' ATTR: ' +
  1858.         StrPas(szAttr) + ' VALUE: ' +
  1859.         StrPas(szValue);
  1860.     ShowStrResult(szMsg,'WLHtmlGetTagAttr');
  1861. end;
  1862.  
  1863. procedure TMainDlgForm.HtmlExtractTagAttr;
  1864. var
  1865.     szAttr: array[0..63] of Char;
  1866.     pszValue: PChar;
  1867. begin
  1868.     if ApiDlgHtmlExtractTagAttr(szAttr,SizeOf(szAttr)) then
  1869.     begin
  1870.         pszValue := WLHtmlExtractTagAttr(hParse,hCurrElement,szAttr);
  1871.         if pszValue = Nil then
  1872.             ShowBoolResult(False,'WLHtmlExtractTagAttr')
  1873.         else
  1874.             ShowStrResult(StrPas(pszValue),'WLHtmlExtractTagAttr');
  1875.     end;
  1876. end;
  1877.  
  1878. procedure TMainDlgForm.HtmlFindText;
  1879. var
  1880.     szText: array[0..255] of Char;
  1881.     hElement: Htmlpars.HELEMENT;
  1882. begin
  1883.     szText[0] := Chr(0);
  1884.  
  1885.     if ApiDlgHtmlFindText(szText,SizeOf(szText)) then
  1886.     begin
  1887.         hElement := WLHtmlFindText(hParse,hCurrElement,szText);
  1888.         if hElement = 0 then
  1889.             ShowBoolResult(False,'WLHtmlFindText')
  1890.         else
  1891.         begin
  1892.             ShowBoolResult(True,'WLHtmlFindText');
  1893.              hCurrElement := hElement;
  1894.              hCurrTagAttr := 0;
  1895.         end;
  1896.     end;
  1897. end;
  1898.  
  1899. procedure TMainDlgForm.HtmlFindSpecial;
  1900. var
  1901.     szText: array[0..255] of Char;
  1902.     hElement: Htmlpars.HELEMENT;
  1903. begin
  1904.     szText[0] := Chr(0);
  1905.  
  1906.     if ApiDlgHtmlFindSpecial(szText,SizeOf(szText)) then
  1907.     begin
  1908.         hElement := WLHtmlFindSpecial(hParse,hCurrElement,szText);
  1909.         if hElement = 0 then
  1910.             ShowBoolResult(False,'WLHtmlFindSpecial')
  1911.         else
  1912.         begin
  1913.             ShowBoolResult(True,'WLHtmlFindSpecial');
  1914.              hCurrElement := hElement;
  1915.              hCurrTagAttr := 0;
  1916.         end;
  1917.     end;
  1918. end;
  1919.  
  1920. procedure TMainDlgForm.HtmlFindComment;
  1921. var
  1922.     szText: array[0..255] of Char;
  1923.     hElement: Htmlpars.HELEMENT;
  1924. begin
  1925.     szText[0] := Chr(0);
  1926.  
  1927.     if ApiDlgHtmlFindComment(szText,SizeOf(szText)) then
  1928.     begin
  1929.         hElement := WLHtmlFindComment(hParse,hCurrElement,szText);
  1930.         if hElement = 0 then
  1931.             ShowBoolResult(False,'WLHtmlFindComment')
  1932.         else
  1933.         begin
  1934.             ShowBoolResult(True,'WLHtmlFindComment');
  1935.              hCurrElement := hElement;
  1936.              hCurrTagAttr := 0;
  1937.         end;
  1938.     end;
  1939. end;
  1940.  
  1941. procedure TMainDlgForm.HtmlFindTagType;
  1942. var
  1943.     nTag: Word;
  1944.     hElement: Htmlpars.HELEMENT;
  1945. begin
  1946.     nTag := HTML_BASE;
  1947.  
  1948.     if ApiDlgHtmlFindTagType(nTag) then
  1949.     begin
  1950.         hElement := WLHtmlFindTagType(hParse,hCurrElement,nTag);
  1951.         if hElement = 0 then
  1952.             ShowBoolResult(False,'WLHtmlFindTagType')
  1953.         else
  1954.         begin
  1955.             ShowBoolResult(True,'WLHtmlFindTagType');
  1956.              hCurrElement := hElement;
  1957.              hCurrTagAttr := 0;
  1958.         end;
  1959.     end;
  1960. end;
  1961.  
  1962. procedure TMainDlgForm.HtmlFindTagName;
  1963. var
  1964.     szTag: array[0..63] of Char;
  1965.     hElement: Htmlpars.HELEMENT;
  1966. begin
  1967.     szTag[0] := Chr(0);
  1968.  
  1969.     if ApiDlgHtmlFindTagName(szTag,SizeOf(szTag)) then
  1970.     begin
  1971.         hElement := WLHtmlFindTagName(hParse,hCurrElement,szTag);
  1972.         if hElement = 0 then
  1973.             ShowBoolResult(False,'WLHtmlFindTagName')
  1974.         else
  1975.         begin
  1976.             ShowBoolResult(True,'WLHtmlFindTagName');
  1977.              hCurrElement := hElement;
  1978.              hCurrTagAttr := 0;
  1979.         end;
  1980.     end;
  1981. end;
  1982.  
  1983. procedure TMainDlgForm.HtmlFindTagAttr;
  1984. var
  1985.     szAttr: array[0..63] of Char;
  1986.     szValue: array[0..255] of Char;
  1987.     nTag: Word;
  1988.     hElement: Htmlpars.HELEMENT;
  1989. begin
  1990.     szAttr[0] := Chr(0);
  1991.     szValue[0] := Chr(0);
  1992.     nTag := HTML_BASE;
  1993.  
  1994.     if ApiDlgHtmlFindTagAttr(szAttr,SizeOf(szAttr),szValue,SizeOf(szValue),nTag) then
  1995.     begin
  1996.         hElement := WLHtmlFindTagAttr(hParse,hCurrElement,nTag,szAttr,szValue);
  1997.         if hElement = 0 then
  1998.             ShowBoolResult(False,'WLHtmlFindTagAttr')
  1999.         else
  2000.         begin
  2001.             ShowBoolResult(True,'WLHtmlFindTagAttr');
  2002.              hCurrElement := hElement;
  2003.              hCurrTagAttr := 0;
  2004.         end;
  2005.     end;
  2006. end;
  2007.  
  2008. procedure TMainDlgForm.HtmlEnumFindText;
  2009. var
  2010.     szText: array[0..255] of Char;
  2011. begin
  2012.     szText[0] := Chr(0);
  2013.  
  2014.     if ApiDlgHtmlEnumFindText(szText,SizeOf(szText)) then
  2015.         if WLHtmlEnumFindText(hParse,hCurrElement,szText,Handle,
  2016.             WM_WEBLIB_ENUMFINDTEXT) then
  2017.             ShowBoolResult(True,'WLHtmlEnumFindText')
  2018.         else
  2019.             ShowBoolResult(False,'WLHtmlEnumFindText');
  2020. end;
  2021.  
  2022. procedure TMainDlgForm.HtmlEnumFindSpecial;
  2023. var
  2024.     szText: array[0..255] of Char;
  2025. begin
  2026.     szText[0] := Chr(0);
  2027.  
  2028.     if ApiDlgHtmlEnumFindSpecial(szText,SizeOf(szText)) then
  2029.         if WLHtmlEnumFindSpecial(hParse,hCurrElement,szText,Handle,
  2030.             WM_WEBLIB_ENUMFINDSPEC) then
  2031.             ShowBoolResult(True,'WLHtmlEnumFindSpecial')
  2032.         else
  2033.             ShowBoolResult(False,'WLHtmlEnumFindSpecial');
  2034. end;
  2035.  
  2036. procedure TMainDlgForm.HtmlEnumFindComment;
  2037. var
  2038.     szText: array[0..255] of Char;
  2039. begin
  2040.     szText[0] := Chr(0);
  2041.  
  2042.     if ApiDlgHtmlEnumFindComment(szText,SizeOf(szText)) then
  2043.         if WLHtmlEnumFindComment(hParse,hCurrElement,szText,Handle,
  2044.             WM_WEBLIB_ENUMFINDCOMM) then
  2045.             ShowBoolResult(True,'WLHtmlEnumFindComment')
  2046.         else
  2047.             ShowBoolResult(False,'WLHtmlEnumFindComment');
  2048. end;
  2049.  
  2050. procedure TMainDlgForm.HtmlEnumFindTagType;
  2051. var
  2052.     nTag: Word;
  2053. begin
  2054.     nTag := HTML_BASE;
  2055.  
  2056.     if ApiDlgHtmlEnumFindTagType(nTag) then
  2057.         if WLHtmlEnumFindTagType(hParse,hCurrElement,nTag,Handle,
  2058.             WM_WEBLIB_ENUMFINDTAGTYPE) then
  2059.             ShowBoolResult(True,'WLHtmlEnumFindTagType')
  2060.         else
  2061.             ShowBoolResult(False,'WLHtmlEnumFindTagType');
  2062. end;
  2063.  
  2064. procedure TMainDlgForm.HtmlEnumFindTagName;
  2065. var
  2066.     szTag: array[0..63] of Char;
  2067. begin
  2068.     szTag[0] := Chr(0);
  2069.  
  2070.     if ApiDlgHtmlEnumFindTagName(szTag,SizeOf(szTag)) then
  2071.         if WLHtmlEnumFindTagName(hParse,hCurrElement,szTag,Handle,
  2072.             WM_WEBLIB_ENUMFINDTAGNAME) then
  2073.             ShowBoolResult(True,'WLHtmlEnumFindTagName')
  2074.         else
  2075.             ShowBoolResult(False,'WLHtmlEnumFindTagName');
  2076. end;
  2077.  
  2078. procedure TMainDlgForm.HtmlEnumFindTagAttr;
  2079. var
  2080.     szAttr: array[0..63] of Char;
  2081.     szValue: array[0..255] of Char;
  2082.     nTag: Word;
  2083. begin
  2084.     szAttr[0] := Chr(0);
  2085.     szValue[0] := Chr(0);
  2086.     nTag := HTML_BASE;
  2087.  
  2088.     if ApiDlgHtmlEnumFindTagAttr(szAttr,SizeOf(szAttr),szValue,SizeOf(szValue),
  2089.         nTag) then
  2090.         if WLHtmlEnumFindTagAttr(hParse,hCurrElement,nTag,szAttr,szValue,Handle,
  2091.             WM_WEBLIB_ENUMFINDTAGATTR) then
  2092.              ShowBoolResult(True,'WLHtmlEnumFindTagAttr')
  2093.         else
  2094.             ShowBoolResult(False,'WLHtmlEnumFindTagAttr');
  2095. end;
  2096.  
  2097. procedure TMainDlgForm.AppendFormData;
  2098. var
  2099.     szData: array[0..255] of Char;
  2100.     szName: array[0..63] of Char;
  2101. begin
  2102.     szName[0] := Chr(0);
  2103.     szData[0] := Chr(0);
  2104.  
  2105.     if ApiDlgAppendFormData(szData,SizeOf(szData),szName,SizeOf(szName)) then
  2106.     begin
  2107.         hFormData := WLAppendFormData(hFormData,szName,szData,SizeOf(szData));
  2108.         if hFormData = 0 then
  2109.             ShowBoolResult(False,'WLAppendFormData')
  2110.         else
  2111.         begin
  2112.             ShowBoolResult(True,'WLAppendFormData');
  2113.              OPENCLOSE_BTN.Enabled := True;
  2114.         end;
  2115.     end;
  2116. end;
  2117.  
  2118. procedure TMainDlgForm.GetFormDataLength;
  2119. var
  2120.     wLength: Word;
  2121. begin
  2122.     if hFormData = 0 then
  2123.         ShowBoolResult(False,'WLGetFormDataLength')
  2124.     else
  2125.     begin
  2126.         wLength := WLGetFormDataLength(hFormData);
  2127.         ShowStrResult(IntToStr(wLength),'WLGetFormDataLength')
  2128.     end;
  2129. end;
  2130.  
  2131. procedure TMainDlgForm.ParseAbsoluteURL;
  2132. var
  2133.     szURL: array[0..255] of Char;
  2134.     szProtocol: array[0..15] of Char;
  2135.     szHost: array[0..63] of Char;
  2136.     szPath: array[0..127] of Char;
  2137.     nPort: Word;
  2138.     szMsg: string;
  2139. begin
  2140.     szURL[0] := Chr(0);
  2141.     szProtocol[0] := Chr(0);
  2142.     szHost[0] := Chr(0);
  2143.     szPath[0] := Chr(0);
  2144.     nPort := 0;
  2145.  
  2146.     if ApiDlgParseAbsoluteURL(szURL,SizeOf(szURL)) then
  2147.         if WLParseAbsoluteURL(szURL,szProtocol,SizeOf(szProtocol),szHost,
  2148.             SizeOf(szHost),nPort,szPath,SizeOf(szPath)) then
  2149.         begin
  2150.             szMsg := StrPas(szProtocol) + ' ' +
  2151.                      StrPas(szHost) + ' ' +
  2152.                       IntToStr(nPort) + ' ' +
  2153.                       StrPas(szPath);
  2154.             ShowStrResult(szMsg,'WLParseAbsoluteURL');
  2155.         end
  2156.         else
  2157.              ShowBoolResult(False,'WLParseAbsoluteURL');
  2158. end;
  2159.  
  2160. procedure TMainDlgForm.ShowBoolResult(bResult: Bool; const szName: String);
  2161. begin
  2162.     if bResult then
  2163.         PROMPT_STATIC.Caption := szName + ': SUCCESS'
  2164.     else
  2165.         PROMPT_STATIC.Caption := 'WebLib API failed: ' + szName;
  2166. end;
  2167.  
  2168. procedure TMainDlgForm.ShowStrResult(const szParm: String; const szName: String);
  2169. begin
  2170.     PROMPT_STATIC.Caption := szName + ': [' + szParm + ']';
  2171. end;
  2172.  
  2173. procedure TMainDlgForm.ShowStrResult2(const szParm1: String; const szParm2: String;
  2174.     const szName: String);
  2175. begin
  2176.     PROMPT_STATIC.Caption := szName + ': [' + szParm1 + '] [' + szParm2 + ']';
  2177. end;
  2178.  
  2179. procedure TMainDlgForm.HandleWeblibNotifyEvent (var msg: TMessage);
  2180. var
  2181.     dwTrx: LongInt;
  2182.     dwWindow: LongInt;
  2183.     dwMax: LongInt;
  2184.     dwFlags: LongInt;
  2185.     dwProgress: LongInt;
  2186.     dwX: LongInt;
  2187.     dwY: LongInt;
  2188.     dwWidth: LongInt;
  2189.     dwHeight: LongInt;
  2190.     pszProgress: PChar;
  2191.     pszURL: pChar;
  2192.     pszMIME: pChar;
  2193.     pszRef: pChar;
  2194.     pszFile: pChar;
  2195.     pszFormData: pChar;
  2196.     nButtonID: Word;
  2197.     szMsg: String;
  2198.     szTempFile: String;
  2199.     szPTempFile: array[0..255] of Char;
  2200. begin
  2201.     case msg.wParam of
  2202.     WLN_BEGINPROGRESS:
  2203.     begin
  2204.         dwTrx := WLNGetTransaction(msg.LParam);
  2205.         pszProgress := WLNGetProgressString(msg.LParam);
  2206.         szMsg := 'BEGINPROGRESS:' +
  2207.                 IntToStr(dwTrx) + ' ' +
  2208.                  StrPas(pszProgress);
  2209.         AddProgressString(szMsg);
  2210.     end;
  2211.  
  2212.     WLN_SETPROGRESSRANGE:
  2213.     begin
  2214.         dwTrx := WLNGetTransaction(msg.LParam);
  2215.         dwMax := WLNGetProgressMaximum(msg.LParam);
  2216.         szMsg := 'SETPROGRESSRANGE:' +
  2217.                 IntToStr(dwTrx) + ' ' +
  2218.                  IntToStr(dwMax);
  2219.         AddProgressString(szMsg);
  2220.     end;
  2221.  
  2222.     WLN_MAKINGPROGRESS:
  2223.     begin;
  2224.         dwTrx := WLNGetTransaction(msg.LParam);
  2225.         dwProgress := WLNGetProgressValue(msg.LParam);
  2226.         pszProgress := WLNGetProgressString(msg.LParam);
  2227.         szMsg := 'MAKINGPROGRESS:' +
  2228.                 IntToStr(dwTrx) + ' ' +
  2229.                  IntToStr(dwProgress) + ' ' +
  2230.                  StrPas(pszProgress);
  2231.         AddProgressString(szMsg);
  2232.     end;
  2233.  
  2234.     WLN_ENDPROGRESS:
  2235.     begin
  2236.         dwTrx := WLNGetTransaction(msg.LParam);
  2237.         szMsg := 'ENDPROGRESS:' + IntToStr(dwTrx);
  2238.         AddProgressString(szMsg);
  2239.     end;
  2240.  
  2241.     WLN_FINISHED:
  2242.     begin
  2243.         dwTrx := WLNGetTransaction(msg.LParam);
  2244.         dwWindow := WLNGetWindow(msg.LParam);
  2245.         szMsg := 'FINISHED:' + IntToStr(dwTrx) + ' ' + IntToStr(dwWindow);
  2246.         AddProgressString(szMsg);
  2247.     end;
  2248.  
  2249.     WLN_CANCELED:
  2250.     begin
  2251.         dwTrx := WLNGetTransaction(msg.LParam);
  2252.         szMsg := 'CANCELED:' + IntToStr(dwTrx);
  2253.         AddProgressString(szMsg);
  2254.     end;
  2255.  
  2256.     WLN_URLECHO:
  2257.     begin
  2258.          dwWindow := WLNGetWindow(msg.LParam);
  2259.         pszURL := WLNGetURL(msg.LParam);
  2260.         pszMIME := WLNGetMIMEType(msg.LParam);
  2261.         pszRef := WLNGetReferrer(msg.LParam);
  2262.         szMsg := 'URLECHO:' +
  2263.                 IntToStr(dwWindow) + ' ' +
  2264.                  StrPas(pszURL) + ' ' +
  2265.                  StrPas(pszMIME) + ' ' +
  2266.                  StrPas(pszRef);
  2267.         nfyRegURLEcho.Add(szMsg);
  2268.     end;
  2269.  
  2270.     WLN_OPENURL:
  2271.     begin
  2272.          dwWindow := WLNGetWindow(msg.LParam);
  2273.         dwTrx := WLNGetTransaction(msg.LParam);
  2274.         dwFlags := WLNGetFlags(msg.LParam);
  2275.         pszURL := WLNGetURL(msg.LParam);
  2276.         pszMIME := WLNGetMIMEType(msg.LParam);
  2277.         pszFile := WLNGetSaveFile(msg.LParam);
  2278.         pszFormData := WLNGetFormData(msg.LParam);
  2279.         szMsg := 'OPENURL: WIN=' +
  2280.                 IntToStr(dwWindow) + ' TX=' +
  2281.                  IntToStr(dwTrx) + ' FL=' +
  2282.                  IntToStr(dwFlags) + ' URL=' +
  2283.                  StrPas(pszURL) + ' MIME=' +
  2284.                  StrPas(pszMIME) + ' FILE=' +
  2285.                  StrPas(pszFile) + ' FMDATA=' +
  2286.                  StrPas(pszFormData);
  2287.         nfyRegProtocol.Add(szMsg);
  2288.     end;
  2289.  
  2290.     WLN_WINDOWCHANGE:
  2291.     begin
  2292.          dwWindow := WLNGetWindow(msg.LParam);
  2293.         dwFlags := WLNGetFlags(msg.LParam);
  2294.         dwX := WLNGetX(msg.LParam);
  2295.         dwY := WLNGetY(msg.LParam);
  2296.         dwWidth := WLNGetWidth(msg.LParam);
  2297.         dwHeight := WLNGetHeight(msg.LParam);
  2298.         szMsg := 'WINDOWCHANGE: WIN=' +
  2299.                  IntToStr(dwWindow) + ' FL=' +
  2300.                  IntToStr(dwFlags) + ' X=' +
  2301.                  IntToStr(dwX) + ' Y=' +
  2302.                  IntToStr(dwY) + ' CX=' +
  2303.                  IntToStr(dwWidth) + ' CY=' +
  2304.                  IntToStr(dwHeight);
  2305.         nfyRegWindowChange.Add(szMsg);
  2306.     end;
  2307.  
  2308.     WLN_QUERYVIEWER:
  2309.     begin
  2310.          pszURL := WLNGetURL(msg.LParam);
  2311.         pszMIME := WLNGetMIMEType(msg.LParam);
  2312.         szMsg := 'QUERYVIEWER: ' + StrPas(pszURL) + ' ' + StrPas(pszMIME);
  2313.         nfyRegViewer.Add(szMsg);
  2314.  
  2315.         szTempFile := 'C:\TEMP\' + IntToHex(GetTickCount,8) + '.HTM';
  2316.         StrPCopy(szPTempFile,szTempFile);
  2317.         WLNSetFileName(msg.LParam,szPTempFile);
  2318.     end;
  2319.  
  2320.     WLN_VIEWDOCFILE:
  2321.     begin
  2322.          pszURL := WLNGetURL(msg.LParam);
  2323.         pszMIME := WLNGetMIMEType(msg.LParam);
  2324.         pszFile := WLNGetFileName(msg.LParam);
  2325.         dwWindow := WLNGetWindow(msg.LParam);
  2326.         szMsg := 'VIEWDOCFILE: ' +
  2327.                  StrPas(pszURL) + ' ' +
  2328.                  StrPas(pszMIME) + ' ' +
  2329.                  StrPas(pszFile) + ' ' +
  2330.                  IntToStr(dwWindow);
  2331.         nfyRegViewer.Add(szMsg);
  2332.     end;
  2333.  
  2334.     WLN_BUTTONCLICKED:
  2335.     begin
  2336.          nButtonID := WLNGetButtonID(msg.LParam);
  2337.         szMsg := 'BUTTONCLICKED: ' + IntToStr(nButtonID);
  2338.         nfyToolbar.Add(szMsg);
  2339.     end;
  2340.  
  2341.     WLN_BROWSERSTART:
  2342.     begin
  2343.         szMsg := 'BROWSERSTART';        { not recorded, example only }
  2344.     end;
  2345.  
  2346.     WLN_BROWSEREXIT:
  2347.     begin
  2348.         szMsg := 'BROWSEREXIT';         { not recorded, example only }
  2349.     end;
  2350.  
  2351.     else
  2352.         ;
  2353.     end;
  2354. end;
  2355.  
  2356. procedure TMainDlgForm.HandleEnumParseTree (var msg: TMessage);
  2357. begin
  2358.     nfyEnumParseTree.Add(MakeEnumHtmlString(msg.LParam,msg.WParam));
  2359.     msg.Result := 1;    { must be TRUE (1) to continue enumeration }
  2360. end;
  2361.  
  2362. procedure TMainDlgForm.HandleEnumFindText (var msg: TMessage);
  2363. begin
  2364.     nfyEnumFindText.Add(MakeEnumHtmlString(msg.LParam,msg.WParam));
  2365.     msg.Result := 1;
  2366. end;
  2367.  
  2368. procedure TMainDlgForm.HandleEnumFindSpecial (var msg: TMessage);
  2369. begin
  2370.     nfyEnumFindSpecial.Add(MakeEnumHtmlString(msg.LParam,msg.WParam));
  2371.     msg.Result := 1;
  2372.     ;
  2373. end;
  2374.  
  2375. procedure TMainDlgForm.HandleEnumFindComment (var msg: TMessage);
  2376. begin
  2377.     nfyEnumFindComment.Add(MakeEnumHtmlString(msg.LParam,msg.WParam));
  2378.     msg.Result := 1;
  2379.     ;
  2380. end;
  2381.  
  2382. procedure TMainDlgForm.HandleEnumFindTagType (var msg: TMessage);
  2383. begin
  2384.     nfyEnumFindTagType.Add(MakeEnumHtmlString(msg.LParam,msg.WParam));
  2385.     msg.Result := 1;
  2386. end;
  2387.  
  2388. procedure TMainDlgForm.HandleEnumFindTagName (var msg: TMessage);
  2389. begin
  2390.     nfyEnumFindTagName.Add(MakeEnumHtmlString(msg.LParam,msg.WParam));
  2391.     msg.Result := 1;
  2392. end;
  2393.  
  2394. procedure TMainDlgForm.HandleEnumFindTagAttr (var msg: TMessage);
  2395. begin
  2396.     nfyEnumFindTagAttr.Add(MakeEnumHtmlString(msg.LParam,msg.WParam));
  2397.     msg.Result := 1;
  2398. end;
  2399.  
  2400. procedure TMainDlgForm.AddProgressString(const szMsg: String);
  2401. begin
  2402.     case API_LIST.ItemIndex of
  2403.     WLAPI_ShowFile:
  2404.         nfyShowFile.Add(szMsg);
  2405.     WLAPI_OpenURL:
  2406.         nfyOpenURL.Add(szMsg);
  2407.     WLAPI_SaveURL:
  2408.         nfySaveURL.Add(szMsg);
  2409.     WLAPI_PostFormData:
  2410.         nfyPostFormData.Add(szMsg);
  2411.     WLAPI_SaveFormData:
  2412.         nfySaveFormData.Add(szMsg);
  2413.     else
  2414.         ;
  2415.     end;
  2416. end;
  2417.  
  2418. procedure TMainDlgForm.BrowserUI;
  2419. var
  2420.     bInfoBtn: Bool;
  2421.     bStatusBtn: Bool;
  2422. begin
  2423.     bInfoBtn := False;
  2424.     bStatusBtn := False;
  2425.  
  2426.     case API_LIST.ItemIndex of
  2427.     WLAPI_ShowFile,
  2428.     WLAPI_OpenURL,
  2429.     WLAPI_SaveURL,
  2430.     WLAPI_PostFormData,
  2431.     WLAPI_SaveFormData,
  2432.     WLAPI_RegisterProtocol,
  2433.     WLAPI_RegisterURLEcho,
  2434.     WLAPI_RegisterViewer,
  2435.     WLAPI_RegisterWindowChange:
  2436.         bInfoBtn := True
  2437.     end;
  2438.  
  2439.     case API_LIST.ItemIndex of
  2440.     WLAPI_RegisterProtocol,
  2441.     WLAPI_RegisterViewer,
  2442.     WLAPI_RegisterWindowChange,
  2443.     WLAPI_RegisterURLEcho:
  2444.         bStatusBtn := True;
  2445.     end;
  2446.  
  2447.     INFO_BTN.Enabled := bInfoBtn;
  2448.     STATUS_BTN.Enabled := bStatusBtn;
  2449. end;
  2450.  
  2451. procedure TMainDlgForm.ToolbarUI;
  2452. begin
  2453.     INFO_BTN.Enabled := True;
  2454.     STATUS_BTN.Enabled := True;
  2455. end;
  2456.  
  2457. procedure TMainDlgForm.ParserUI;
  2458. var
  2459.     bInfoBtn: Bool;
  2460. begin
  2461.     bInfoBtn := False;
  2462.  
  2463.     case API_LIST.ItemIndex of
  2464.     WLAPI_HtmlEnumParseTree,
  2465.     WLAPI_HtmlEnumFindText,
  2466.     WLAPI_HtmlEnumFindSpecial,
  2467.     WLAPI_HtmlEnumFindComment,
  2468.     WLAPI_HtmlEnumFindTagType,
  2469.     WLAPI_HtmlEnumFindTagName,
  2470.     WLAPI_HtmlEnumFindTagAttr:
  2471.         bInfoBtn := True
  2472.     end;
  2473.  
  2474.     INFO_BTN.Enabled := bInfoBtn;
  2475.     STATUS_BTN.Enabled := False;
  2476. end;
  2477.  
  2478. procedure TMainDlgForm.UtilityUI;
  2479. begin
  2480.     INFO_BTN.Enabled := False;
  2481.     STATUS_BTN.Enabled := False;
  2482. end;
  2483.  
  2484. procedure TMainDlgForm.BrowserNotifications;
  2485. begin
  2486.     case API_LIST.ItemIndex of
  2487.     WLAPI_ShowFile:
  2488.         INFO_LIST.Items := nfyShowFile;
  2489.     WLAPI_OpenURL:
  2490.         INFO_LIST.Items := nfyOpenURL;
  2491.     WLAPI_SaveURL:
  2492.         INFO_LIST.Items := nfySaveURL;
  2493.     WLAPI_PostFormData:
  2494.         INFO_LIST.Items := nfyPostFormData;
  2495.     WLAPI_SaveFormData:
  2496.         INFO_LIST.Items := nfySaveFormData;
  2497.     WLAPI_RegisterProtocol:
  2498.         INFO_LIST.Items := nfyRegProtocol;
  2499.     WLAPI_RegisterURLEcho:
  2500.         INFO_LIST.Items := nfyRegURLEcho;
  2501.     WLAPI_RegisterViewer:
  2502.         INFO_LIST.Items := nfyRegViewer;
  2503.     WLAPI_RegisterWindowChange:
  2504.         INFO_LIST.Items := nfyRegWindowChange;
  2505.     end;
  2506. end;
  2507.  
  2508. procedure TMainDlgForm.ToolbarNotifications;
  2509. begin
  2510.     INFO_LIST.Items := nfyToolbar;
  2511. end;
  2512.  
  2513. procedure TMainDlgForm.ParserNotifications;
  2514. begin
  2515.     case API_LIST.ItemIndex of
  2516.     WLAPI_HtmlEnumParseTree:
  2517.         INFO_LIST.Items := nfyEnumParseTree;
  2518.     WLAPI_HtmlEnumFindText:
  2519.         INFO_LIST.Items := nfyEnumFindText;
  2520.     WLAPI_HtmlEnumFindSpecial:
  2521.         INFO_LIST.Items := nfyEnumFindSpecial;
  2522.     WLAPI_HtmlEnumFindComment:
  2523.         INFO_LIST.Items := nfyEnumFindComment;
  2524.     WLAPI_HtmlEnumFindTagType:
  2525.         INFO_LIST.Items := nfyEnumFindTagType;
  2526.     WLAPI_HtmlEnumFindTagName:
  2527.         INFO_LIST.Items := nfyEnumFindTagName;
  2528.     WLAPI_HtmlEnumFindTagAttr:
  2529.         INFO_LIST.Items := nfyEnumFindTagAttr;
  2530.     end;
  2531. end;
  2532.  
  2533. procedure TMainDlgForm.UtilityNotifications;
  2534. begin
  2535.     ;  { no-op }
  2536. end;
  2537.  
  2538. procedure TMainDlgForm.BrowserStatus;
  2539. begin
  2540.     case API_LIST.ItemIndex of
  2541.     WLAPI_RegisterProtocol:
  2542.         INFO_LIST.Items := staRegProtocol;
  2543.     WLAPI_RegisterViewer:
  2544.         INFO_LIST.Items := staRegViewer;
  2545.     WLAPI_RegisterWindowChange:
  2546.         INFO_LIST.Items := staRegWindowChange;
  2547.     WLAPI_RegisterURLEcho:
  2548.     begin
  2549.          if staRegURLEcho then
  2550.               INFO_LIST.Items.Add('Registered');
  2551.     end;
  2552.     end;
  2553. end;
  2554.  
  2555. procedure TMainDlgForm.ToolbarStatus;
  2556. begin
  2557.     INFO_LIST.Items := staToolbar;
  2558. end;
  2559.  
  2560. procedure TMainDlgForm.ParserStatus;
  2561. begin
  2562.     ; { no-op }
  2563. end;
  2564.  
  2565. procedure TMainDlgForm.UtilityStatus;
  2566. begin
  2567.     ; { no-op }
  2568. end;
  2569.  
  2570. function TMainDlgForm.MakeEnumHtmlString(LParam: LongInt; WParam: Word) : String;
  2571. var
  2572.     szMsg: String;
  2573.     pszText: PChar;
  2574.     nType: Integer;
  2575.     lAttr: LongInt;
  2576. begin
  2577.     pszText := Nil;
  2578.     nType := 0;
  2579.     lAttr := 0;
  2580.  
  2581.     case WParam of
  2582.     WL_ROOT:
  2583.         szMsg := 'ROOT';
  2584.  
  2585.     WL_TEXT:
  2586.     begin
  2587.         pszText := WLHtmlGetElementText(hParse,LParam);
  2588.         lAttr := WLHtmlGetTextAttr(hParse,LParam);
  2589.         szMsg := 'TEXT: ' + StrPas(pszText) + ' ' + IntToHex(lAttr,8);
  2590.     end;
  2591.  
  2592.     WL_TAG:
  2593.     begin
  2594.         pszText := WLHtmlGetTagName(hParse,LParam);
  2595.         nType := WLHtmlGetTagType(hParse,LParam);
  2596.         szMsg := 'TAG: ' + StrPas(pszText) + ' ' + IntToStr(nType);
  2597.     end;
  2598.  
  2599.     WL_SPECIALCHAR:
  2600.     begin
  2601.         pszText := WLHtmlGetElementText(hParse,LParam);
  2602.         szMsg := 'SPECIALCHAR: ' + StrPas(pszText);
  2603.     end;
  2604.  
  2605.     WL_COMMENT:
  2606.     begin
  2607.         pszText := WLHtmlGetElementText(hParse,LParam);
  2608.         szMsg := 'COMMENT: ' + StrPas(pszText);
  2609.     end;
  2610.  
  2611.     else
  2612.         szMsg := '???';
  2613.     end;
  2614.  
  2615.     MakeEnumHtmlString := szMsg;
  2616. end;
  2617.  
  2618. end.
  2619.  
  2620.