Delphi ÖÐWebBrowser¿Ø¼þÏê½âʵÀý
Delphi ÖÐWebBrowser¿Ø¼þÏê½âʵÀý ת
2008-05-07 12:07
ºÜ¾Ã¶¼Ã»ÓÐÔ´´ÁË£¬Ç°¼¸Ìì°ïÅóÓÑ×öÁ˸öÍøÖ··¢²¼³ÌÐò£¬Ö÷ÒªÓ¦Óõ½ÁËWebBrowser¿Ø¼þ¡£
½ñÌìÖ÷Òª¸ø´ó¼ÒÑÝʾһϹý³Ì£¬Èôó¼ÒѧϰһÏÂDelphi¹¤¾ß¡£
WebBrowser¹¦ÄÜ£º
1¡£×Ô¶¯¼ÓÔØÍøÒ³
2¡£È¥³ýWebBrowser¹ö¶¯Ìõ
3¡£WebBrowser×ÔÉí´ò¿ªÒ³Ãæ
4¡£½ûÖ¹ÓÒ¼ü
1¡£Ê×ÏÈ£¬Ð½¨Ò»¸öfrom´°Ì壺
2¡£¼ÓÈëÒ»¸öWEBBROWSER¿Ø¼þ
3¡£µ÷ÕûºóÈçÏ£º
4.ÕâÑùÒ»¸öwebbrowser¾ÍÍê³ÉÁË£¬ÏÂÒ»²½ÎÒÃÇÀ´ÈóÌÐò´ò¿ªºó×Ô¶¯¼ÓÔØÒ»¸öÍøÒ³¡£
ºËÐÄ´úÂ룺WebBrowser1.Navigate('http://v.28.la');
Ë«»÷´°Ìå»ÒÉ«´¦£¬¶Ô´°Ìå½øÐгõʼ»¯£¬ÔÚ´úÂë´°¿ÚÖÐÊäÈ루Begin Óë End¼äÊäÈëºËÐÄ´úÂ룩£º
procedure TForm1.FormCreate(Sender: TObject);
begin
WebBrowser1.Navigate('http://v.28.la'); //´°Ìå³õʼ»¯Íê³ÉWEBBROWSER¼ÓÔØÒ»¸öÍøÒ³
end;
5¡£ÏÂÃæÎÒÃÇÀ´ÊµÏÖ½ûÖ¹WEBBROWSER¿Ø¼þµÄ¹ö¶¯Ìõ¹¦ÄÜ£º
ºËÐÄ´úÂ룺WebBrowser1.oleobject.Document.body.Scroll:= ‘no’;
ÀûÓÃÕâ¸ö´úÂëÈ¥µô¹ö¶¯ÌõµÄÇ°ÌáÊÇwebbrowserÖбØÐëÓдò¿ªµÄÍøÒ³£¬Ò²¾ÍÊÇÔÚÍøÒ³¼ÓÔØÍê
Íê±ÏºóÔÙÈ¥µô¹ö¶¯Ìõ¡£ËùÒÔÊ×ÏÈÒªÅжÏÒ³ÃæÊÇ·ñ¼ÓÔØÍê±Ï£¬Èç¹û¼ÓÔØÍê±Ï£¬¾ÍÖ´ÐÐÉÏÃæµÄÓï¾ä
È¥µô¹ö¶¯Ìõ¡£Õâʱ¾ÍÒªÒýÈëÒ»¸ö°´Å¤¿Ø¼þÀ´´¥·¢³ÌÐò
¼ÓÈëSPEEDBUTTEN
µ÷ÕûÐκó£º
ºÃÁË£¬ÏÖÔÚ¿ÉÒÔʵÏÖ½ûÖ¹¹ö¶¯ÌõµÄ¹¦ÄÜÁË£º
µÚÒ»²½£ºÔÚWebBrowser1DocumentCompleteʼþÖÐÖÃÒ»¸ö±êÖ¾tag:=1(´ú±í¼ÓÔØÍê±Ï)
µ¥»÷WEBBROWSER¿Ø¼þ£¬ÔÚWebBrowserÊôÐÔ
µÄEVENSʼþÖÐÕÒµ½WebBrowser1DocumentComplete £¨Ë«»÷£©
È»ºóÔÚ´úÂë´°¿ÚÖÐÊäÈ룺
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
tag:=1; //È¥µôWebbrowser1¹ö¶¯ÌõµÄ±êÖ¾
end;
¶ÔSpeedButten¿Ø¼þ²Ù×÷£º£¨Ë«»÷onClick)
¼ÓÈëÈçÏ´úÂ룺
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
Doc: IHTMLDocument2;
begin
tag := 0; //È¥µôWebbrowser1¹ö¶¯ÌõµÄ±êÖ¾
WebBrowser1.Navigate2(’http://www.baidu.com’);
while(tag=0) do Application.ProcessMessages;
WebBrowser1.oleobject.Document.body.Scroll := ‘no’;
end;
×¢Ò⣺ʹÓÃÇ°±ØÐëÔÚusesÖмÓÈëmshtml;
ÕâÑùWebBrowser¾Í½ûÖ¹Á˹ö¶¯Ìõ¡£Ö÷ÒªÓ¦Ó
Ïà¹ØÎĵµ£º
1£¬¹æ·¶¼ò½é
¡¡¡¡±¾¹æ·¶Ö÷Òª¹æ¶¨DelphiÔ´³ÌÐòÔÚÊéд¹ý³ÌÖÐËùÓ¦×ñѵĹæÔò¼°×¢ÒâÊÂÏî¡£±àд¸Ã¹æ·¶µÄÄ¿µÄÊÇʹ¹«Ë¾Èí¼þ¿ª·¢ÈËÔ±µÄÔ´´úÂëÊéдϰ¹ß±£³ÖÒ»Ö¡£ÕâÑù×ö¿ÉÒÔʹÿһ¸ö×éÔ±¶¼¿ÉÒÔÀí½âÆäËü×éÔ±µÄ´úÂ룬ÒÔ±ãÓÚÔ´´úÂëµÄ¶þ´Î¿ª·¢¼ÇÒäϵͳµÄά»¤¡£
2£¬Ò»°ã¸ñʽ¹æ·¶
2.1 Ëõ½ø
¡¡¡¡Ëõ½ø¾ÍÊÇÔÚµ±Ô´³ÌÐòµÄ¼¶¸Ä±äʱΪÔö¼Ó¿É¶Á ......
Ç°¶Îʱ¼äÒòΪÏîÄ¿ÐèÒª£¬»ñÈ¡Ö¸¶¨ÎļþµÄͼ±ê£¬ÈÆÁ˺ܶàÍä×Ó£¬ÏÖÔÚŪ³öÀ´ÁË£¬¸ú´ó¼Ò¹²ÏíÏÂ.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ShellAPI, ExtCtrls;
type
TForm1 = class(TForm)
l ......
Delphi±àдϵͳ·þÎñÈý£º±àдÁ½ÆÜϵͳ·þÎñ ÊÕ²Ø
²ÉÓÃÏÂÃæµÄ·½·¨£¬¿ÉÒÔʵÏÖÒ»¸öÁ½ÆÜϵͳ·þÎñ£¨¼Èϵͳ·þÎñºÍ×ÀÃæ³ÌÐòµÄÁ½ÖÖģʽ£©
¹¤³Ì´úÂ룺
program FleetReportSvr;
uses
SvcMgr,
Forms,
SysUtils,
Windows,
SvrMain in 'SvrMain.pas' {FleetReportService: TService}, ......
Delphi±àдϵͳ·þÎñ¶þ£ºÏµÍ³·þÎñºÍ×ÀÃæ³ÌÐòµÄÇø±ð ÊÕ²Ø
Windows 2000/XP/2003µÈÖ§³ÖÒ»ÖÖ½Ð×ö“ϵͳ·þÎñ³ÌÐò”µÄ½ø³Ì£¬ÏµÍ³·þÎñºÍ×ÀÃæ³ÌÐòµÄÇø±ðÊÇ£º
ϵͳ·þÎñ²»Óõǽϵͳ¼´¿ÉÔËÐУ»
ϵͳ·þÎñÊÇÔËÐÐÔÚSystem Idle Process/System/smss/winlogon/servicesϵģ¬¶ø×ÀÃæ³ÌÐòÊÇÔËÐÐÔÚExplorerϵģ»
......
ÓÃwebbrowser¿Ø¼þµÇ¼ºÍÏÔʾÍøÒ³
MSHTMLÊÇ΢Èí¹«Ë¾µÄÒ»¸öCOM×é¼þ£¬¸Ã×é¼þ·â×°ÁËHTMLÓïÑÔÖеÄËùÓÐÔªËؼ°ÆäÊôÐÔ£¬Í¨¹ýÆäÌṩµÄ±ê×¼½Ó¿Ú£¬¿ÉÒÔ·ÃÎÊÖ¸¶¨ÍøÒ³µÄËùÓÐÔªËØ£®MSHTML¶ÔÏóÄ£ÐÍÊÇÓÉһЩ¶ÔÏóºÍ¼¯ºÏ×é³ÉµÄ£®´¦ÓÚ¸ù²¿µÄÊÇHTML£¬ÃèÊöÁË´ò¿ªÒ³ÃæµÄ1¸ö´°¿Ú£¬°üÀ¨Ò»ÏµÁм¯ºÏºÍ¶ÔÏó¡£ÈçFrames¼¯ºÏ£¬History£¬Location£¬Navigat ......