⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 winapi查询
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
namespace WindowsApplication1
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class fmmain : System.Windows.Forms.Form
	{
		private System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
		private System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
		private System.Data.OleDb.OleDbConnection oleDbConnection1;
		private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
		private System.Windows.Forms.Button button1;
		private System.Data.DataSet dataSet1;
		private System.Windows.Forms.TextBox CXNR;
		private System.Windows.Forms.CheckBox checkBox1;
		private System.Windows.Forms.CheckBox checkBox2;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.RadioButton R1;
		private System.Windows.Forms.RadioButton R2;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.ListBox listBox1;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public fmmain()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand();
			this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
			this.oleDbInsertCommand1 = new System.Data.OleDb.OleDbCommand();
			this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter();
			this.button1 = new System.Windows.Forms.Button();
			this.dataSet1 = new System.Data.DataSet();
			this.CXNR = new System.Windows.Forms.TextBox();
			this.R1 = new System.Windows.Forms.RadioButton();
			this.R2 = new System.Windows.Forms.RadioButton();
			this.checkBox1 = new System.Windows.Forms.CheckBox();
			this.checkBox2 = new System.Windows.Forms.CheckBox();
			this.label1 = new System.Windows.Forms.Label();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.listBox1 = new System.Windows.Forms.ListBox();
			((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
			this.SuspendLayout();
			// 
			// oleDbSelectCommand1
			// 
			this.oleDbSelectCommand1.CommandText = "SELECT win95, winNT, 别名, 参数表, 返回值, 函数, 库名, 例程, 其它, 说明 FROM winfun";
			this.oleDbSelectCommand1.Connection = this.oleDbConnection1;
			// 
			// oleDbConnection1
			// 
			this.oleDbConnection1.ConnectionString = @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Database Password=;Data Source=""WinApi.mdb"";Password=;Jet OLEDB:Engine Type=4;Jet OLEDB:Global Bulk Transactions=1;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False";
			// 
			// oleDbInsertCommand1
			// 
			this.oleDbInsertCommand1.CommandText = "INSERT INTO winfun(win95, winNT, 别名, 参数表, 返回值, 函数, 库名, 例程, 其它, 说明) VALUES (?, ?, " +
				"?, ?, ?, ?, ?, ?, ?, ?)";
			this.oleDbInsertCommand1.Connection = this.oleDbConnection1;
			this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("win95", System.Data.OleDb.OleDbType.VarWChar, 10, "win95"));
			this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("winNT", System.Data.OleDb.OleDbType.VarWChar, 10, "winNT"));
			this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("别名", System.Data.OleDb.OleDbType.VarWChar, 40, "别名"));
			this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("参数表", System.Data.OleDb.OleDbType.VarWChar, 0, "参数表"));
			this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("返回值", System.Data.OleDb.OleDbType.VarWChar, 0, "返回值"));
			this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("函数", System.Data.OleDb.OleDbType.VarWChar, 40, "函数"));
			this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("库名", System.Data.OleDb.OleDbType.VarWChar, 30, "库名"));
			this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("例程", System.Data.OleDb.OleDbType.VarWChar, 0, "例程"));
			this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("其它", System.Data.OleDb.OleDbType.VarWChar, 0, "其它"));
			this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("说明", System.Data.OleDb.OleDbType.VarWChar, 0, "说明"));
			// 
			// oleDbDataAdapter1
			// 
			this.oleDbDataAdapter1.InsertCommand = this.oleDbInsertCommand1;
			this.oleDbDataAdapter1.SelectCommand = this.oleDbSelectCommand1;
			this.oleDbDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																										new System.Data.Common.DataTableMapping("Table", "winfun", new System.Data.Common.DataColumnMapping[] {
																																																				  new System.Data.Common.DataColumnMapping("win95", "win95"),
																																																				  new System.Data.Common.DataColumnMapping("winNT", "winNT"),
																																																				  new System.Data.Common.DataColumnMapping("别名", "别名"),
																																																				  new System.Data.Common.DataColumnMapping("参数表", "参数表"),
																																																				  new System.Data.Common.DataColumnMapping("返回值", "返回值"),
																																																				  new System.Data.Common.DataColumnMapping("函数", "函数"),
																																																				  new System.Data.Common.DataColumnMapping("库名", "库名"),
																																																				  new System.Data.Common.DataColumnMapping("例程", "例程"),
																																																				  new System.Data.Common.DataColumnMapping("其它", "其它"),
																																																				  new System.Data.Common.DataColumnMapping("说明", "说明")})});
			this.oleDbDataAdapter1.RowUpdated += new System.Data.OleDb.OleDbRowUpdatedEventHandler(this.oleDbDataAdapter1_RowUpdated);
			// 
			// button1
			// 
			this.button1.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
			this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.button1.Location = new System.Drawing.Point(456, 8);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(128, 32);
			this.button1.TabIndex = 1;
			this.button1.Text = "关于";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// dataSet1
			// 
			this.dataSet1.DataSetName = "NewDataSet";
			this.dataSet1.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// CXNR
			// 
			this.CXNR.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.CXNR.Location = new System.Drawing.Point(105, 13);
			this.CXNR.Name = "CXNR";
			this.CXNR.Size = new System.Drawing.Size(224, 21);
			this.CXNR.TabIndex = 2;
			this.CXNR.Text = "请输入关键字。。。";
			this.CXNR.TextChanged += new System.EventHandler(this.CXNR_TextChanged);
			// 
			// R1
			// 
			this.R1.Checked = true;
			this.R1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.R1.Location = new System.Drawing.Point(344, 1);
			this.R1.Name = "R1";
			this.R1.TabIndex = 3;
			this.R1.TabStop = true;
			this.R1.Text = "查询函数";
			// 
			// R2
			// 
			this.R2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.R2.Location = new System.Drawing.Point(344, 25);
			this.R2.Name = "R2";
			this.R2.TabIndex = 4;
			this.R2.Text = "查询过程";
			// 
			// checkBox1
			// 
			this.checkBox1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.checkBox1.Location = new System.Drawing.Point(608, 8);
			this.checkBox1.Name = "checkBox1";
			this.checkBox1.TabIndex = 5;
			this.checkBox1.Text = "适用Win95";
			// 
			// checkBox2
			// 
			this.checkBox2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.checkBox2.Location = new System.Drawing.Point(608, 32);
			this.checkBox2.Name = "checkBox2";
			this.checkBox2.TabIndex = 6;
			this.checkBox2.Text = "适用WinNt";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 16);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(88, 16);
			this.label1.TabIndex = 7;
			this.label1.Text = "查询关键字";
			// 
			// textBox1
			// 
			this.textBox1.Location = new System.Drawing.Point(24, 80);
			this.textBox1.Multiline = true;
			this.textBox1.Name = "textBox1";
			this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
			this.textBox1.Size = new System.Drawing.Size(688, 352);
			this.textBox1.TabIndex = 12;
			this.textBox1.Text = "textBox1";
			// 
			// listBox1
			// 
			this.listBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.listBox1.ItemHeight = 12;
			this.listBox1.Location = new System.Drawing.Point(105, 34);
			this.listBox1.Name = "listBox1";
			this.listBox1.Size = new System.Drawing.Size(224, 158);
			this.listBox1.TabIndex = 13;
			this.listBox1.Visible = false;
			this.listBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listBox1_MouseUp_1);
			// 
			// fmmain
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(744, 461);
			this.Controls.Add(this.listBox1);
			this.Controls.Add(this.textBox1);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.checkBox2);
			this.Controls.Add(this.checkBox1);
			this.Controls.Add(this.R2);
			this.Controls.Add(this.R1);
			this.Controls.Add(this.CXNR);
			this.Controls.Add(this.button1);
			this.Name = "fmmain";
			this.Text = "WinAPI查询.net";
			this.Click += new System.EventHandler(this.fmmain_Click);
			this.Load += new System.EventHandler(this.fmmain_Load);
			((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new fmmain());
		}

		private void oleDbDataAdapter1_RowUpdated(object sender, System.Data.OleDb.OleDbRowUpdatedEventArgs e)
		{
		
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			//
			
		}

		private void CXNR_TextChanged(object sender, System.EventArgs e)
		{
			listBox1.Visible=true;
			listBox1.Items.Clear();
			getname();
		}
		private void getname()
		{
			int i;
			this.checkBox1.Checked=false;
			this.checkBox2.Checked=false;
			if (R1.Checked)
			{
				this.oleDbDataAdapter1.SelectCommand.CommandText="select * from funclass where name like'"+CXNR.Text+"%'";
				dataSet1.Clear();
				this.oleDbDataAdapter1.Fill(dataSet1);
				for(i=0;i<dataSet1.Tables[0].Rows.Count;i++)
				{
					this.listBox1.Items.Add(dataSet1.Tables[0].Rows[i]["name"].ToString());
				}
				
			}
			if (R2.Checked)
			{
				this.oleDbDataAdapter1.SelectCommand.CommandText="select * from winfun where 函数 like'"+CXNR.Text+"%'";
				dataSet1.Clear();
				this.oleDbDataAdapter1.Fill(dataSet1);
				
				for(i=0;i<dataSet1.Tables[0].Rows.Count;i++)
				{
				this.listBox1.Items.Add(dataSet1.Tables[0].Rows[i]["函数"].ToString());
				}
			
			}
		}

		private void listBox1_MouseUp_1(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			string[] ta1;
			string[] ta2;
			this.CXNR.Text =this.listBox1.Items[this.listBox1.SelectedIndex].ToString();
			listBox1.Visible=false;
			textBox1.Clear();
			if (R1.Checked)
			{
				this.oleDbDataAdapter1.SelectCommand.CommandText="select * from funclass where name='"+CXNR.Text+"'";
				this.dataSet1.Clear();
				this.oleDbDataAdapter1.Fill(this.dataSet1);
				ta1 = new string[4];
				ta1[0]="函数名:";
				ta1[1]=dataSet1.Tables[0].Rows[0]["name"].ToString();
				ta1[2]="全名:";
				ta1[3]=dataSet1.Tables[0].Rows[0]["fullname"].ToString();
				this.textBox1.Lines=ta1;
				
			}
			if (R2.Checked)
			{
				this.oleDbDataAdapter1.SelectCommand.CommandText="select * from winfun where 函数='"+CXNR.Text+"'";
				this.dataSet1.Clear();
				this.oleDbDataAdapter1.Fill(this.dataSet1);
				ta2=new string[8];
				ta2[0]="过程名:";
				ta2[1]=dataSet1.Tables[0].Rows[0]["函数"].ToString();
				ta2[2]="例程:";
				ta2[3]=dataSet1.Tables[0].Rows[0]["例程"].ToString();
				ta2[4]="库名:";
				ta2[5]=dataSet1.Tables[0].Rows[0]["库名"].ToString();
				ta2[6]="参数表:";
				ta2[7]=dataSet1.Tables[0].Rows[0]["参数表"].ToString();
				if (dataSet1.Tables[0].Rows[0]["win95"].ToString()=="Yes"){this.checkBox1.Checked=true;}
				if (dataSet1.Tables[0].Rows[0]["winnt"].ToString()=="Yes"){this.checkBox2.Checked=true;}
				
				this.textBox1.Lines=ta2;
			}
		}

		private void fmmain_Load(object sender, System.EventArgs e)
		{
			this.textBox1.Clear();
		}

		private void fmmain_Click(object sender, System.EventArgs e)
		{
			this.listBox1.Visible=false;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -