Advertisement
jacob_segundo

mybrowser_delphi7

Jun 1st, 2022
1,628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.68 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, ExtCtrls, ImgList, StdCtrls, OleCtrls, SHDocVw, HTTPApp,
  8.   HTTPProd;
  9.  
  10. type
  11.   TForm1 = class(TForm)
  12.     Panel1: TPanel;
  13.     Panel2: TPanel;
  14.     WebBrowser1: TWebBrowser;
  15.     Edit1: TEdit;
  16.     Image1: TImage;
  17.     Button1: TButton;
  18.     Button2: TButton;
  19.     Button3: TButton;
  20.     Button4: TButton;
  21.     Button5: TButton;
  22.      procedure FormCreate(Sender: TObject);
  23.     procedure Image1Click(Sender: TObject);
  24.     procedure Button1Click(Sender: TObject);
  25.     procedure Button2Click(Sender: TObject);
  26.     procedure Button3Click(Sender: TObject);
  27.     procedure Button4Click(Sender: TObject);
  28.     procedure FormKeyDown(Sender: TObject; var Key: Word;
  29.       Shift: TShiftState);
  30.     procedure Button5Click(Sender: TObject);
  31.  
  32.  
  33.  
  34.  
  35.   private
  36.     { Private declarations }
  37.   public
  38.     { Public declarations }
  39.   end;
  40.  
  41. var
  42.   Form1: TForm1;
  43.   nav, back: boolean;
  44. implementation
  45.  
  46. {$R *.dfm}
  47. procedure TForm1.FormCreate(Sender: TObject);//buscador padrao
  48. begin
  49. WebBrowser1.Silent:=true; //blocked script
  50. Webbrowser1.GoSearch;
  51. end;
  52.  
  53. procedure TForm1.Image1Click(Sender: TObject);  //foto
  54. begin
  55. Image1.Picture.LoadFromFile('img_527746.bmp');
  56. end;
  57.  
  58. procedure TForm1.Button1Click(Sender: TObject);
  59. begin
  60. nav:=True;       //navegar
  61. WebBrowser1.Navigate(Edit1.text);
  62. end;
  63.  
  64. procedure TForm1.Button2Click(Sender: TObject);
  65. begin
  66. webbrowser1.GoHome;//home
  67. end;
  68.  
  69. procedure TForm1.Button3Click(Sender: TObject); //goback
  70. begin
  71. back:=true;
  72. if nav=true then
  73. begin
  74.  WebBrowser1.GoBack;//pagina anterior
  75.  end else
  76.  begin
  77.  showmessage('nenhuma pagina anterior');
  78.  end;
  79. end;
  80.  
  81. procedure TForm1.Button4Click(Sender: TObject); //update
  82. begin
  83. if nav=true then
  84. begin
  85. webBrowser1.Refresh;//atualiza
  86.  end else
  87.  begin
  88.  showmessage('acesse uma pagina primeiro');
  89.  end;
  90. end;
  91.  
  92. procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  93.   Shift: TShiftState);
  94. begin
  95. if key=VK_RETURN then //Navegar
  96. Button1.Click;
  97.  
  98. if (GetKeyState(VK_CONTROL) < 0) and (Key =69) then
  99. Button2.Click;
  100.                                               //pesquisar
  101. if key=VK_F5 then                             //atualizar
  102. Button4.Click;
  103.                                             //voltar pagina anterior
  104. if(GetKeyState(VK_MENU)<0) and (key=37 ) then
  105. Button3.Click;
  106.                                           //proxima pagina
  107. if(GetKeyState(VK_MENU)<0) and (key=39 ) then
  108. Button5.Click;
  109. end;
  110.  
  111. procedure TForm1.Button5Click(Sender: TObject); //pagina anterior
  112. begin
  113. if back=true then
  114. begin
  115. WebBrowser1.GoForward;
  116. end else
  117. begin
  118. showmessage('volte primeiro');
  119. end;
  120. end;
  121.  
  122.  
  123.  
  124. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement