Unit1.cpp
上传用户:lulishicai
上传日期:2010-03-01
资源大小:13202k
文件大小:2k
源码类别:

Delphi/CppBuilder

开发平台:

C++ Builder

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Unit1.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma link "SHDocVw_OCX"
  8. #pragma resource "*.dfm"
  9. TForm1 *Form1;
  10. //---------------------------------------------------------------------------
  11. __fastcall TForm1::TForm1(TComponent* Owner)
  12.         : TForm(Owner)
  13. {
  14. }
  15. //---------------------------------------------------------------------------
  16. //响应"连接"按钮
  17. void __fastcall TForm1::connectClick(TObject *Sender)
  18. {
  19.   OleVariant a,b,c,d;
  20.   WideString  str;
  21.   str=Edit1->Text;
  22.   WebBrowser1->Navigate(str,a,b,c,d);
  23. }
  24. //---------------------------------------------------------------------------
  25. //响应"前进"按钮
  26. void __fastcall TForm1::Button2Click(TObject *Sender)
  27. {
  28.  WebBrowser1->GoForward();
  29. }
  30. //---------------------------------------------------------------------------
  31. //响应"后退"按钮
  32. void __fastcall TForm1::Button3Click(TObject *Sender)
  33. {
  34.  WebBrowser1->GoBack();
  35. }
  36. //---------------------------------------------------------------------------
  37. //响应"主页"按钮
  38. void __fastcall TForm1::Button4Click(TObject *Sender)
  39. {
  40.  WebBrowser1->GoHome();
  41. }
  42. //---------------------------------------------------------------------------
  43. //响应"刷新"按钮
  44. void __fastcall TForm1::Button5Click(TObject *Sender)
  45. {
  46.  WebBrowser1->Refresh();
  47. }
  48. //---------------------------------------------------------------------------
  49. //响应"停止"按钮
  50. void __fastcall TForm1::Button6Click(TObject *Sender)
  51. {
  52.  WebBrowser1->Stop();
  53.  WebBrowser1->GoHome();
  54. }
  55. //---------------------------------------------------------------------------
  56. void __fastcall TForm1::Edit1KeyPress(TObject *Sender, char &Key)
  57. {
  58.  if(Key==13)
  59.     connectClick(Sender);
  60. }
  61. //---------------------------------------------------------------------------