windows应用程序版的google搜索引擎源码

//Form1.cs

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Diagnostics;

namespace WindowsApplication2
{

 public class Form1 : System.Windows.Forms.Form
 {
  private System.Windows.Forms.TextBox textBox2;
  private System.Windows.Forms.Button button1;
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.Label label2;
  private System.Windows.Forms.ListBox listBox1;
  private String sKey;

  private System.ComponentModel.Container components = null;

  public Form1()
  {
   InitializeComponent();
  }


  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region Windows Form Designer generated code

  private void InitializeComponent()
  {
   this.textBox2 = new System.Windows.Forms.TextBox();
   this.button1 = new System.Windows.Forms.Button();
   this.label1 = new System.Windows.Forms.Label();
   this.label2 = new System.Windows.Forms.Label();
   this.listBox1 = new System.Windows.Forms.ListBox();
   this.SuspendLayout();
   //
   // textBox2
   //
   this.textBox2.Location = new System.Drawing.Point(8, 32);
   this.textBox2.Name = "textBox2";
   this.textBox2.Size = new System.Drawing.Size(240, 21);
   this.textBox2.TabIndex = 1;
   this.textBox2.Text = "ERP";
   //
   // button1
   //
   this.button1.Location = new System.Drawing.Point(264, 32);
   this.button1.Name = "button1";
   this.button1.TabIndex = 2;
   this.button1.Text = "搜索";
   this.button1.Click += new System.EventHandler(this.button1_Click);
   //
   // label1
   //
   this.label1.BackColor = System.Drawing.SystemColors.Info;
   this.label1.Location = new System.Drawing.Point(136, 8);
   this.label1.Name = "label1";
   this.label1.Size = new System.Drawing.Size(104, 16);
   this.label1.TabIndex = 3;
   this.label1.Text = "单击此处获得帮助";
   this.label1.Click += new System.EventHandler(this.label1_Click);
   //
   // label2
   //
   this.label2.Location = new System.Drawing.Point(8, 8);
   this.label2.Name = "label2";
   this.label2.TabIndex = 4;
   this.label2.Text = "请输入关键字: ";
   //
   // listBox1
   //
   this.listBox1.HorizontalScrollbar = true;
   this.listBox1.ItemHeight = 12;
   this.listBox1.Location = new System.Drawing.Point(8, 64);
   this.listBox1.Name = "listBox1";
   this.listBox1.Size = new System.Drawing.Size(360, 292);
   this.listBox1.TabIndex = 5;
   this.listBox1.DoubleClick += new System.EventHandler(this.listBox1_DoubleClick);
   //
   // Form1
   //
   this.AcceptButton = this.button1;
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.ClientSize = new System.Drawing.Size(376, 365);
   this.Controls.Add(this.listBox1);
   this.Controls.Add(this.label2);
   this.Controls.Add(this.label1);
   this.Controls.Add(this.button1);
   this.Controls.Add(this.textBox2);
   this.Name = "Form1";
   this.Text = "Google搜索引擎 V1.0 by yzwgh@sina.com";
   this.ResumeLayout(false);

  }
  #endregion


  [STAThread]
  static void Main()
  {
   Application.Run(new Form1());
  }

  private void button1_Click(object sender, System.EventArgs e)
  {
   try
   {
    sKey="R1SnlcZQFHIBYlBCYdip3j1ERCvueU2Z";
    googleapi.GoogleSearchService s=new googleapi.GoogleSearchService();

   
    googleapi.GoogleSearchResult r=s.doGoogleSearch(sKey, textBox2.Text,
     0, 10, false, "", false, "", "", "");
    googleapi.ResultElement[] re=r.resultElements;
    this.listBox1.Items.Clear();
    for (int i=0;i<re.Length;i++)
    {

     this.listBox1.Items.Add((object)(re[i].title));
     this.listBox1.Items.Add((object)(re[i].URL));

    }
   }
   catch(Exception eee)
   {
    MessageBox.Show(eee.Message,this.Text );
   }

  }

  private void listBox1_DoubleClick(object sender, System.EventArgs e)
  {
   try
   {
    String url;
    url=listBox1.Text;
    Process p  = Process.Start(@url);
   }
   catch (Exception ee)
   {
    MessageBox.Show(ee.Message);
   }
  }

  private void label1_Click(object sender, System.EventArgs e)
  {
   String s;
   s=this.Text + "/n";
   s=s+"作者:yzwgh/n";
   s=s+"EMail:yzwgh@sina.com/n";
   s=s+"双击下面的网址可打开相应的链接。";
   MessageBox.Show(s,this.Text );
  }
 }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
### 回答1: Android串口链接工具码(Android Studio)是一种用于在Android设备上与串口进行通信的工具的代码。它可以作为一个示例项目来帮助开发人员学习如何在Android平台上实现串口通信。 该码通常由以下几个主要部分组成: 1. 串口连接处理:这部分代码负责建立与串口设备的连接,并设置波特率、数据位、校验位等参数。它可以使用Android提供的串口通信API或第三方库来实现。 2. 数据发送与接收:这部分代码负责发送数据到串口设备和接收从串口设备返回的数据。它通常包含一个发送线程和一个接收线程,分别负责发送和接收数据,并通过缓冲区来进行数据的处理。 3. 数据解析与处理:这部分代码负责解析从串口设备返回的数据,并根据需要进行处理。例如,可以将接收到的数据转换为字符串或其他格式,以便在界面上显示或进行后续的业务逻辑处理。 4. 用户界面:这部分代码负责实现用户界面,并提供交互方式来控制串口连接和数据的发送与接收。它通常包含一些按钮、输入框和文本框等控件,以及与相关功能相关的事件处理代码。 Android Studio是一种适用于Android开发的开发环境,可以用于编写、测试和调试Android应用程序。通过使用Android Studio,开发人员可以在集成开发环境中轻松地编写和管理代码,并运行应用程序以进行实时调试。 总之,Android串口链接工具码(Android Studio)是一个为了帮助开发人员学习和实现在Android平台上与串口设备进行通信的工具,它可以作为一个示例项目来使用和修改。 ### 回答2: 对于获取Android串口链接工具的码,可以尝试在Android Studio中进行搜索和下载。首先,在Android Studio中打开项目,然后使用内置的搜索功能,可以搜索相关的Github仓库或者其他开代码库,以便找到所需的码。另外,可以在Google或者其他搜索引擎上搜索相关的关键词,如“Android串口链接工具码android studio”,然后查找可用的开项目。一旦找到合适的码库,可以下载代码并将其导入到Android Studio中进行进一步研究和修改。 Android串口链接工具主要用于在Android设备上通过串口与外部设备进行通信,包括读取和写入数据等操作。码通常包含必要的类、文件和资,并提供了用于创建、配置和管理串口连接的接口和方法。了解码的结构和原理,可以进行定制化的开发和适应特定的需求。在使用码之前,需要确保已经配置好开发环境,并具备相关的Android开发经验。 需要注意的是,下载和使用开项目的码时,要遵守该项目所采用的开许可协议,并遵守相关的法律法规。使用码前最好阅读项目的文档和相关许可信息,以确保合法合规。同时,充分了解码的功能和限制,遵循最佳实践,并进行必要的测试和验证,以保障应用的稳定性和安全性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值