| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1143 人关注过本帖
标题:DNS小程序源代码
只看楼主 加入收藏
bceric
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2005-9-14
收藏
 问题点数:0 回复次数:6 
DNS小程序源代码
DNS小程序源代码    请多指教!!
搜索更多相关主题的帖子: 源代码 DNS 
2005-10-10 17:42
bceric
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2005-9-14
收藏
得分:0 

using System.Data; using System.Net; using System.IO;

namespace DNS集成服务系统 { /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.SaveFileDialog saveFileDialog1; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Button button1; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.RichTextBox richTextBox1; private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.NumericUpDown numericUpDown1; private System.Windows.Forms.NumericUpDown numericUpDown2; private System.Windows.Forms.NumericUpDown numericUpDown3; private System.Windows.Forms.NumericUpDown numericUpDown4; private System.Windows.Forms.NumericUpDown numericUpDown5; private System.Windows.Forms.Button button2; private System.Windows.Forms.ProgressBar progressBar1; private System.Windows.Forms.GroupBox groupBox4; private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button5; private System.Windows.Forms.Button button6; private System.Windows.Forms.Button button7; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null;

public Form1() { // // Required for Windows Form Designer support // InitializeComponent();

// // TOD Add any constructor code after InitializeComponent call // }

/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); }

#region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); this.button4 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button(); this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox3 = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.button3 = new System.Windows.Forms.Button(); this.button7 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.numericUpDown5 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown3 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown4 = new System.Windows.Forms.NumericUpDown(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit(); this.groupBox4.SuspendLayout(); this.SuspendLayout(); // // progressBar1 // this.progressBar1.Location = new System.Drawing.Point(8, 328); this.progressBar1.Name = "progressBar1"; this.progressBar1.Size = new System.Drawing.Size(504, 23); this.progressBar1.TabIndex = 10; // // label1 // this.label1.Location = new System.Drawing.Point(16, 24); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(56, 23); this.label1.TabIndex = 1; this.label1.Text = "名称:"; // // label2 // this.label2.Location = new System.Drawing.Point(16, 64); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(56, 23); this.label2.TabIndex = 1; this.label2.Text = "IP地址:"; // // label3 // this.label3.Location = new System.Drawing.Point(8, 32); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(72, 23); this.label3.TabIndex = 1; this.label3.Text = "远程主机:"; // // saveFileDialog1 // this.saveFileDialog1.FileName = "doc1"; // // button4 // this.button4.Location = new System.Drawing.Point(16, 248); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(75, 24); this.button4.TabIndex = 0; this.button4.Text = "保存记录"; this.button4.Click += new System.EventHandler(this.button4_Click); // // button5 // this.button5.Location = new System.Drawing.Point(120, 248); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(75, 24); this.button5.TabIndex = 0; this.button5.Text = "查看记录"; this.button5.Click += new System.EventHandler(this.button5_Click); // // button6 // this.button6.Location = new System.Drawing.Point(120, 288); this.button6.Name = "button6"; this.button6.Size = new System.Drawing.Size(75, 24); this.button6.TabIndex = 0; this.button6.Text = "关闭"; this.button6.Click += new System.EventHandler(this.button6_Click); // // textBox2 // this.textBox2.Location = new System.Drawing.Point(80, 64); this.textBox2.Name = "textBox2"; this.textBox2.TabIndex = 2; this.textBox2.Text = ""; // // textBox3 // this.textBox3.Location = new System.Drawing.Point(96, 32); this.textBox3.Name = "textBox3"; this.textBox3.TabIndex = 2; this.textBox3.Text = ""; // // button1 // this.button1.Location = new System.Drawing.Point(200, 24); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 24); this.button1.TabIndex = 0; this.button1.Text = "查询"; this.button1.Click += new System.EventHandler(this.button1_Click); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(80, 24); this.textBox1.Name = "textBox1"; this.textBox1.TabIndex = 2; this.textBox1.Text = ""; // // button3 // this.button3.Location = new System.Drawing.Point(56, 64); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 24); this.button3.TabIndex = 0; this.button3.Text = "查询"; this.button3.Click += new System.EventHandler(this.button3_Click); // // button7 // this.button7.Location = new System.Drawing.Point(16, 288); this.button7.Name = "button7"; this.button7.Size = new System.Drawing.Size(75, 24); this.button7.TabIndex = 0; this.button7.Text = "清理记录"; this.button7.Click += new System.EventHandler(this.button7_Click); // // button2 // this.button2.Location = new System.Drawing.Point(24, 64); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 24); this.button2.TabIndex = 0; this.button2.Text = "开始扫描"; this.button2.Click += new System.EventHandler(this.button2_Click); // // richTextBox1 // this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.richTextBox1.Location = new System.Drawing.Point(3, 17); this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.Size = new System.Drawing.Size(306, 172); this.richTextBox1.TabIndex = 4; this.richTextBox1.Text = ""; this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged); // // groupBox1 // this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.textBox2); this.groupBox1.Controls.Add(this.textBox1); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.button1); this.groupBox1.Location = new System.Drawing.Point(216, 24); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(312, 100); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; this.groupBox1.Text = "本地主机(无需输入)"; // // groupBox2 // this.groupBox2.Controls.Add(this.richTextBox1); this.groupBox2.Location = new System.Drawing.Point(216, 128); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(312, 192); this.groupBox2.TabIndex = 5; this.groupBox2.TabStop = false; this.groupBox2.Text = "查询记录"; // // groupBox3 // this.groupBox3.Controls.Add(this.button2); this.groupBox3.Controls.Add(this.numericUpDown5); this.groupBox3.Controls.Add(this.numericUpDown1); this.groupBox3.Controls.Add(this.numericUpDown2); this.groupBox3.Controls.Add(this.numericUpDown3); this.groupBox3.Controls.Add(this.numericUpDown4); this.groupBox3.Location = new System.Drawing.Point(8, 24); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(200, 96); this.groupBox3.TabIndex = 9; this.groupBox3.TabStop = false; this.groupBox3.Text = "扫描主机"; // // numericUpDown5 // this.numericUpDown5.Location = new System.Drawing.Point(152, 64); this.numericUpDown5.Maximum = new System.Decimal(new int[] { 225, 0, 0, 0}); this.numericUpDown5.Name = "numericUpDown5"; this.numericUpDown5.Size = new System.Drawing.Size(40, 21); this.numericUpDown5.TabIndex = 8; this.numericUpDown5.Value = new System.Decimal(new int[] { 225, 0, 0, 0}); // // numericUpDown1 // this.numericUpDown1.Location = new System.Drawing.Point(8, 24); this.numericUpDown1.Maximum = new System.Decimal(new int[] { 225, 0, 0, 0}); this.numericUpDown1.Name = "numericUpDown1"; this.numericUpDown1.Size = new System.Drawing.Size(40, 21); this.numericUpDown1.TabIndex = 6; this.numericUpDown1.Value = new System.Decimal(new int[] { 202, 0, 0, 0}); // // numericUpDown2 // this.numericUpDown2.Location = new System.Drawing.Point(56, 24); this.numericUpDown2.Maximum = new System.Decimal(new int[] { 225, 0, 0, 0}); this.numericUpDown2.Name = "numericUpDown2"; this.numericUpDown2.Size = new System.Drawing.Size(40, 21); this.numericUpDown2.TabIndex = 6; this.numericUpDown2.Value = new System.Decimal(new int[] { 207, 0, 0, 0}); // // numericUpDown3 // this.numericUpDown3.Location = new System.Drawing.Point(104, 24); this.numericUpDown3.Maximum = new System.Decimal(new int[] { 225, 0, 0, 0}); this.numericUpDown3.Name = "numericUpDown3"; this.numericUpDown3.Size = new System.Drawing.Size(40, 21); this.numericUpDown3.TabIndex = 7; this.numericUpDown3.Value = new System.Decimal(new int[] { 123, 0, 0, 0}); // // numericUpDown4 // this.numericUpDown4.Location = new System.Drawing.Point(152, 24); this.numericUpDown4.Maximum = new System.Decimal(new int[] {


2005-10-10 17:44
bceric
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2005-9-14
收藏
得分:0 

0, 0}); this.numericUpDown4.Name = "numericUpDown4"; this.numericUpDown4.Size = new System.Drawing.Size(40, 21); this.numericUpDown4.TabIndex = 8; this.numericUpDown4.Value = new System.Decimal(new int[] { 1, 0, 0, 0}); // // groupBox4 // this.groupBox4.Controls.Add(this.textBox3); this.groupBox4.Controls.Add(this.label3); this.groupBox4.Controls.Add(this.button3); this.groupBox4.Location = new System.Drawing.Point(8, 128); this.groupBox4.Name = "groupBox4"; this.groupBox4.TabIndex = 11; this.groupBox4.TabStop = false; this.groupBox4.Text = "远程查询(支持IP和名称)"; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(528, 357); this.Controls.Add(this.button7); this.Controls.Add(this.button6); this.Controls.Add(this.button5); this.Controls.Add(this.button4); this.Controls.Add(this.groupBox4); this.Controls.Add(this.progressBar1); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.MaximizeBox = false; this.Name = "Form1"; this.Text = "DNS集成服务系统"; this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox3.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit(); this.groupBox4.ResumeLayout(false); this.ResumeLayout(false);

} #endregion

/// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); }

private void button2_Click(object sender, System.EventArgs e) { //下行构造字符串 string aa=numericUpDown1.Text+"."+numericUpDown2.Text+"."+ numericUpDown3.Text+"."; //下行转换为整型 int i=Int32.Parse(numericUpDown4.Text); int k=i; //下行转换为整型 int j=Int32.Parse(numericUpDown5.Text); //下行设置进度条最小值 progressBar1.Minimum=i; //下行设置进度条最大值 progressBar1.Maximum=j; for(i=i;i<=j;i++) { string bb=aa+i.ToString(); //下行将字符串转换为IP型 IPAddress myIP = IPAddress.Parse(bb); try { //下行获得主机信息 IPHostEntry myHost = Dns.GetHostByAddress(myIP); //下行获得主机名并转换为字符串 string cc=myHost.HostName.ToString(); //下行将数据加入到richTextBox1 richTextBox1.AppendText(bb+"-->"+cc+"\r"); }//对应try的“{” catch(Exception ee){richTextBox1.AppendText(bb+"-->"+ee.Message+"\r");} //下行设置进度条当前值 progressBar1.Value=i; }//对应for(i=0;i<j;i++)的“{”

// progressBar1.Value=k; }

private void button1_Click(object sender, System.EventArgs e) { IPHostEntry myHost=new IPHostEntry(); try { myHost=Dns.GetHostByName(Dns.GetHostName()); textBox1.Text=myHost.HostName.ToString(); richTextBox1.AppendText("本地主机名称-->"+myHost.HostName.ToString()+"\r"); for(int i=0;i<myHost.AddressList.Length;i++) { textBox2.Text=myHost.AddressList[i].ToString(); richTextBox1.AppendText("本地主机IP地址-->"+myHost.AddressList[i].ToString()+"\r"); } } catch(Exception ee){MessageBox.Show(ee.Message);} }

private void button3_Click(object sender, System.EventArgs e) { IPHostEntry myHost=new IPHostEntry(); myHost=Dns.Resolve(textBox3.Text); for(int i=0;i<myHost.AddressList.Length;i++) { richTextBox1.AppendText(textBox3.Text+"的IP地址-->"+myHost.AddressList[i].ToString()+"\r"); } }

private void button4_Click(object sender, System.EventArgs e) { StreamWriter sw=null; saveFileDialog1.Filter="文本文件(*.txt)|*.txt|Word文档(*.doc)|*.doc|所有文件(*.*)|*.*"; if(saveFileDialog1.ShowDialog()==DialogResult.OK) { try { sw=new StreamWriter(saveFileDialog1.FileName,false,System.Text.Encoding.Unicode); sw.Write(richTextBox1.Text);} catch(Exception excep){MessageBox.Show(excep.Message);} finally{if(sw!=null){sw.Close();} }//对应finally{

} //对应if(saveFileDialog1.ShowDialog()==DialogResult.OK)

}

private void button5_Click(object sender, System.EventArgs e) { string aa; try { openFileDialog1.Filter="文本文件(*.txt)|*.txt|Word文档(*.doc)|*.doc|所有文件(*.*)|*.*"; if(openFileDialog1.ShowDialog()==DialogResult.OK) { aa=File.OpenText(openFileDialog1.FileName).ReadToEnd(); richTextBox1.AppendText(aa); File.OpenText(openFileDialog1.FileName).Close(); } }//try catch(Exception ee){MessageBox.Show(ee.Message);}

}

private void button7_Click(object sender, System.EventArgs e) { richTextBox1.Clear(); }

private void button6_Click(object sender, System.EventArgs e) { Application.Exit(); }

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


2005-10-10 17:45
bceric
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2005-9-14
收藏
得分:0 

掉了一点东西: 大家看着加上吧

// // numericUpDown4 // this.numericUpDown4.Location = new System.Drawing.Point(152, 24); this.numericUpDown4.Maximum = new System.Decimal(new int[] { 225, 0, 0, 0}); this.numericUpDown4.Name = "numericUpDown4"; this.numericUpDown4.Size = new System.Drawing.Size(40, 21); this.numericUpDown4.TabIndex = 8; this.numericUpDown4.Value = new System.Decimal(new int[] { 1,


2005-10-10 17:50
Smiling
Rank: 1
等 级:新手上路
帖 子:111
专家分:0
注 册:2005-9-7
收藏
得分:0 
你把原程序传上来不是更简洁吗?
2005-10-11 15:10
唐伯猫
Rank: 8Rank: 8
等 级:贵宾
威 望:45
帖 子:5323
专家分:58
注 册:2005-8-9
收藏
得分:0 
同意楼上说法

<iframe name="alimamaifrm" frameborder="0" marginheight="0" marginwidth="0" border="0" scrolling="no" width="300" height="170" src="/go/app/tbk_app/chongzhi_300_170.php?pid=mm_28854300_2441872_11377541&page=chongzhi_300_170.php&size_w=300&size_h=170&stru_phone=1&stru_game=1&stru_travel=1" ></iframe>
2005-10-11 22:22
y19850211
Rank: 4
等 级:贵宾
威 望:12
帖 子:83
专家分:0
注 册:2005-10-2
收藏
得分:0 
这么多!!!你还分几次发!!想累死我们啊!!!!

一次把原代码都发出来不就行了!!!
   太强了!!看的眼都花了!

我是IT的后备人材!!!看到信息请联系我啊@@  Email:y19850211@.cn QQ:4197199
2005-10-12 21:13
快速回复:DNS小程序源代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.049089 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved