Sayfalar
22 Ocak 2017 Pazar
DNS AYAR PROGRAMI
DNS AYAR PROGRAMI_KOD
İNDİR
Güncelleme Tarihi : 11.11.2018
Kod:
Imports System.Xml Imports System.Xml Imports System Imports System.Text Imports Microsoft.Win32 'Register için ' Kayıtlı DNS 'yi Okuma için Imports System.Net.NetworkInformation Imports System.Net ' Imports System.Runtime.InteropServices 'PANO Public Class AnaForm #Region "Değişken Tanımları " Inherits System.Windows.Forms.Form 'Public dns1, dns2 As String Public yer As Integer Public eleman As ListViewItem Friend WithEvents DugmeLst As System.Windows.Forms.ImageList Friend WithEvents LwDNS As System.Windows.Forms.ListView Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader Friend WithEvents ColumnHeader2 As System.Windows.Forms.ColumnHeader Friend WithEvents LstGüncelleBtn As System.Windows.Forms.Button Friend WithEvents SaklaBtn As System.Windows.Forms.Button Friend WithEvents SilBtn As System.Windows.Forms.Button Friend WithEvents DnsNotu As System.Windows.Forms.TextBox Friend WithEvents DnsGosterBtn As System.Windows.Forms.Button Friend WithEvents ListBox1 As System.Windows.Forms.ListBox Friend WithEvents AgMerkeziBtn As System.Windows.Forms.Button Friend WithEvents PMrkLbl As System.Windows.Forms.Label Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents KayitSilBtn As System.Windows.Forms.Button Friend WithEvents DnsAlBtn As System.Windows.Forms.Button Friend WithEvents DNS1_txt As System.Windows.Forms.TextBox Friend WithEvents DNS2_txt As System.Windows.Forms.TextBox Friend WithEvents Lw_EkleBtn As System.Windows.Forms.Button Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents SecilenIndex As System.Windows.Forms.TextBox Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox Friend WithEvents PictBul As System.Windows.Forms.PictureBox #End Region #Region " Form Tasarım üretim Kodları " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog Friend WithEvents SaveFileDialog1 As System.Windows.Forms.SaveFileDialog Private components As System.ComponentModel.IContainer 'Required by the Windows Form Designer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor.
Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(AnaForm)) Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog() Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog() Me.DugmeLst = New System.Windows.Forms.ImageList(Me.components) Me.LwDNS = New System.Windows.Forms.ListView() Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.ColumnHeader2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.PictBul = New System.Windows.Forms.PictureBox() Me.Lw_EkleBtn = New System.Windows.Forms.Button() Me.LstGüncelleBtn = New System.Windows.Forms.Button() Me.DNS2_txt = New System.Windows.Forms.TextBox() Me.SaklaBtn = New System.Windows.Forms.Button() Me.DNS1_txt = New System.Windows.Forms.TextBox() Me.SilBtn = New System.Windows.Forms.Button() Me.DnsNotu = New System.Windows.Forms.TextBox() Me.DnsGosterBtn = New System.Windows.Forms.Button() Me.ListBox1 = New System.Windows.Forms.ListBox() Me.AgMerkeziBtn = New System.Windows.Forms.Button() Me.PMrkLbl = New System.Windows.Forms.Label() Me.LinkLabel1 = New System.Windows.Forms.LinkLabel() Me.Label1 = New System.Windows.Forms.Label() Me.KayitSilBtn = New System.Windows.Forms.Button() Me.DnsAlBtn = New System.Windows.Forms.Button() Me.GroupBox1 = New System.Windows.Forms.GroupBox() Me.SecilenIndex = New System.Windows.Forms.TextBox() Me.GroupBox2 = New System.Windows.Forms.GroupBox() Me.GroupBox3 = New System.Windows.Forms.GroupBox() Me.PictureBox1 = New System.Windows.Forms.PictureBox() CType(Me.PictBul, System.ComponentModel.ISupportInitialize).BeginInit() Me.GroupBox1.SuspendLayout() Me.GroupBox2.SuspendLayout() Me.GroupBox3.SuspendLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'SaveFileDialog1 ' Me.SaveFileDialog1.FileName = "Doküman1" ' 'DugmeLst ' Me.DugmeLst.ImageStream = CType(resources.GetObject("DugmeLst.ImageStream"), System.Windows.Forms.ImageListStreamer) Me.DugmeLst.TransparentColor = System.Drawing.Color.Transparent Me.DugmeLst.Images.SetKeyName(0, "Kaydet-N.png") Me.DugmeLst.Images.SetKeyName(1, "Kaydet-S.png") Me.DugmeLst.Images.SetKeyName(2, "ListeyeAl-N.png") Me.DugmeLst.Images.SetKeyName(3, "ListeyeAl-S.png") Me.DugmeLst.Images.SetKeyName(4, "PanodanAl-N.png") Me.DugmeLst.Images.SetKeyName(5, "PanodanAl-S.png") Me.DugmeLst.Images.SetKeyName(6, "Pano-N.png") Me.DugmeLst.Images.SetKeyName(7, "Pano-S.png") Me.DugmeLst.Images.SetKeyName(8, "SatirSil-N.png") Me.DugmeLst.Images.SetKeyName(9, "SatirSil-S.png") ' 'LwDNS ' Me.LwDNS.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.LwDNS.BackColor = System.Drawing.Color.Wheat Me.LwDNS.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.LwDNS.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader2}) Me.LwDNS.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(162, Byte)) Me.LwDNS.ForeColor = System.Drawing.Color.Black Me.LwDNS.FullRowSelect = True Me.LwDNS.GridLines = True Me.LwDNS.HideSelection = False Me.LwDNS.Location = New System.Drawing.Point(6, 40) Me.LwDNS.MultiSelect = False Me.LwDNS.Name = "LwDNS" Me.LwDNS.Size = New System.Drawing.Size(230, 332) Me.LwDNS.Sorting = System.Windows.Forms.SortOrder.Ascending Me.LwDNS.TabIndex = 19 Me.LwDNS.UseCompatibleStateImageBehavior = False Me.LwDNS.View = System.Windows.Forms.View.Details ' 'ColumnHeader1 ' Me.ColumnHeader1.Text = "DNS-1" Me.ColumnHeader1.Width = 105 ' 'ColumnHeader2 ' Me.ColumnHeader2.Text = "DNS-2" Me.ColumnHeader2.Width = 105 ' 'PictBul ' Me.PictBul.Image = CType(resources.GetObject("PictBul.Image"), System.Drawing.Image) Me.PictBul.Location = New System.Drawing.Point(211, 377) Me.PictBul.Name = "PictBul" Me.PictBul.Size = New System.Drawing.Size(25, 27) Me.PictBul.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.PictBul.TabIndex = 35 Me.PictBul.TabStop = False ' 'Lw_EkleBtn ' Me.Lw_EkleBtn.Location = New System.Drawing.Point(197, 16) Me.Lw_EkleBtn.Name = "Lw_EkleBtn" Me.Lw_EkleBtn.Size = New System.Drawing.Size(39, 20) Me.Lw_EkleBtn.TabIndex = 274 Me.Lw_EkleBtn.Text = "Ekle" Me.Lw_EkleBtn.UseVisualStyleBackColor = True ' 'LstGüncelleBtn ' Me.LstGüncelleBtn.Image = CType(resources.GetObject("LstGüncelleBtn.Image"), System.Drawing.Image) Me.LstGüncelleBtn.Location = New System.Drawing.Point(47, 377) Me.LstGüncelleBtn.Name = "LstGüncelleBtn" Me.LstGüncelleBtn.Size = New System.Drawing.Size(30, 30) Me.LstGüncelleBtn.TabIndex = 32 Me.LstGüncelleBtn.UseVisualStyleBackColor = True ' 'DNS2_txt ' Me.DNS2_txt.BackColor = System.Drawing.SystemColors.Menu Me.DNS2_txt.Location = New System.Drawing.Point(102, 16) Me.DNS2_txt.Name = "DNS2_txt" Me.DNS2_txt.Size = New System.Drawing.Size(93, 20) Me.DNS2_txt.TabIndex = 273 ' 'SaklaBtn ' Me.SaklaBtn.Image = CType(resources.GetObject("SaklaBtn.Image"), System.Drawing.Image) Me.SaklaBtn.Location = New System.Drawing.Point(83, 377) Me.SaklaBtn.Name = "SaklaBtn" Me.SaklaBtn.Size = New System.Drawing.Size(30, 30) Me.SaklaBtn.TabIndex = 29 Me.SaklaBtn.UseVisualStyleBackColor = True ' 'DNS1_txt ' Me.DNS1_txt.BackColor = System.Drawing.SystemColors.Menu Me.DNS1_txt.Location = New System.Drawing.Point(6, 16) Me.DNS1_txt.Name = "DNS1_txt" Me.DNS1_txt.Size = New System.Drawing.Size(93, 20) Me.DNS1_txt.TabIndex = 272 ' 'SilBtn ' Me.SilBtn.Image = CType(resources.GetObject("SilBtn.Image"), System.Drawing.Image) Me.SilBtn.Location = New System.Drawing.Point(7, 377) Me.SilBtn.Name = "SilBtn" Me.SilBtn.Size = New System.Drawing.Size(30, 30) Me.SilBtn.TabIndex = 28 Me.SilBtn.UseVisualStyleBackColor = True ' 'DnsNotu ' Me.DnsNotu.BackColor = System.Drawing.SystemColors.Info Me.DnsNotu.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(162, Byte)) Me.DnsNotu.Location = New System.Drawing.Point(119, 381) Me.DnsNotu.Multiline = True Me.DnsNotu.Name = "DnsNotu" Me.DnsNotu.ShortcutsEnabled = False Me.DnsNotu.Size = New System.Drawing.Size(86, 22) Me.DnsNotu.TabIndex = 17 ' 'DnsGosterBtn ' Me.DnsGosterBtn.BackColor = System.Drawing.Color.DimGray Me.DnsGosterBtn.ForeColor = System.Drawing.SystemColors.ButtonHighlight Me.DnsGosterBtn.Location = New System.Drawing.Point(10, 18) Me.DnsGosterBtn.Name = "DnsGosterBtn" Me.DnsGosterBtn.Size = New System.Drawing.Size(113, 32) Me.DnsGosterBtn.TabIndex = 21 Me.DnsGosterBtn.Text = "Geçerli DNS Göster" Me.DnsGosterBtn.UseVisualStyleBackColor = False ' 'ListBox1 ' Me.ListBox1.BackColor = System.Drawing.SystemColors.Menu Me.ListBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(162, Byte)) Me.ListBox1.FormattingEnabled = True Me.ListBox1.ItemHeight = 16 Me.ListBox1.Location = New System.Drawing.Point(10, 56) Me.ListBox1.Name = "ListBox1" Me.ListBox1.Size = New System.Drawing.Size(142, 36) Me.ListBox1.TabIndex = 22 ' 'AgMerkeziBtn ' Me.AgMerkeziBtn.BackColor = System.Drawing.Color.LightSlateGray Me.AgMerkeziBtn.ForeColor = System.Drawing.SystemColors.ButtonHighlight Me.AgMerkeziBtn.Location = New System.Drawing.Point(10, 19) Me.AgMerkeziBtn.Name = "AgMerkeziBtn" Me.AgMerkeziBtn.Size = New System.Drawing.Size(145, 36) Me.AgMerkeziBtn.TabIndex = 23 Me.AgMerkeziBtn.Text = "Ağ Paylaşım Merkezini Aç" Me.AgMerkeziBtn.UseVisualStyleBackColor = False ' 'PMrkLbl ' Me.PMrkLbl.AutoSize = True Me.PMrkLbl.ForeColor = System.Drawing.SystemColors.HotTrack Me.PMrkLbl.Location = New System.Drawing.Point(30, 58) Me.PMrkLbl.Name = "PMrkLbl" Me.PMrkLbl.Size = New System.Drawing.Size(93, 13) Me.PMrkLbl.TabIndex = 266 Me.PMrkLbl.Text = "AğPaylaşımMrkLbl" Me.PMrkLbl.Visible = False ' 'LinkLabel1 ' Me.LinkLabel1.AutoSize = True Me.LinkLabel1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(162, Byte)) Me.LinkLabel1.Location = New System.Drawing.Point(4, 108) Me.LinkLabel1.Name = "LinkLabel1" Me.LinkLabel1.Size = New System.Drawing.Size(159, 15) Me.LinkLabel1.TabIndex = 267 Me.LinkLabel1.TabStop = True Me.LinkLabel1.Text = "http://192.168.2.1/main.html" ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(162, Byte)) Me.Label1.Location = New System.Drawing.Point(4, 93) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(148, 15) Me.Label1.TabIndex = 268 Me.Label1.Text = "TTNet IP Konfigürasyonu :" ' 'KayitSilBtn ' Me.KayitSilBtn.BackColor = System.Drawing.Color.Peru Me.KayitSilBtn.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(162, Byte)) Me.KayitSilBtn.ForeColor = System.Drawing.SystemColors.ButtonHighlight Me.KayitSilBtn.Location = New System.Drawing.Point(124, 18) Me.KayitSilBtn.Name = "KayitSilBtn" Me.KayitSilBtn.Size = New System.Drawing.Size(29, 32) Me.KayitSilBtn.TabIndex = 269 Me.KayitSilBtn.Text = "Sil" Me.KayitSilBtn.UseVisualStyleBackColor = False ' 'DnsAlBtn ' Me.DnsAlBtn.BackColor = System.Drawing.Color.Gray Me.DnsAlBtn.ForeColor = System.Drawing.SystemColors.ButtonHighlight Me.DnsAlBtn.Location = New System.Drawing.Point(8, 98) Me.DnsAlBtn.Name = "DnsAlBtn" Me.DnsAlBtn.Size = New System.Drawing.Size(145, 37) Me.DnsAlBtn.TabIndex = 270 Me.DnsAlBtn.Text = "DNS Sunucu Adresini Otomatik Al" Me.DnsAlBtn.UseVisualStyleBackColor = False ' 'GroupBox1 ' Me.GroupBox1.Controls.Add(Me.LwDNS) Me.GroupBox1.Controls.Add(Me.SecilenIndex) Me.GroupBox1.Controls.Add(Me.PictBul) Me.GroupBox1.Controls.Add(Me.LstGüncelleBtn) Me.GroupBox1.Controls.Add(Me.SaklaBtn) Me.GroupBox1.Controls.Add(Me.Lw_EkleBtn) Me.GroupBox1.Controls.Add(Me.SilBtn) Me.GroupBox1.Controls.Add(Me.DNS2_txt) Me.GroupBox1.Controls.Add(Me.DNS1_txt) Me.GroupBox1.Controls.Add(Me.DnsNotu) Me.GroupBox1.Location = New System.Drawing.Point(12, 12) Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Size = New System.Drawing.Size(247, 415) Me.GroupBox1.TabIndex = 272 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Listeye DNS Ekleme,Arama,Silme,Kayıt" ' 'SecilenIndex ' Me.SecilenIndex.Location = New System.Drawing.Point(7, 348) Me.SecilenIndex.Name = "SecilenIndex" Me.SecilenIndex.Size = New System.Drawing.Size(42, 20) Me.SecilenIndex.TabIndex = 273 Me.SecilenIndex.Visible = False ' 'GroupBox2 ' Me.GroupBox2.Controls.Add(Me.DnsAlBtn) Me.GroupBox2.Controls.Add(Me.DnsGosterBtn) Me.GroupBox2.Controls.Add(Me.ListBox1) Me.GroupBox2.Controls.Add(Me.KayitSilBtn) Me.GroupBox2.Location = New System.Drawing.Point(279, 12) Me.GroupBox2.Name = "GroupBox2" Me.GroupBox2.Size = New System.Drawing.Size(166, 140) Me.GroupBox2.TabIndex = 273 Me.GroupBox2.TabStop = False Me.GroupBox2.Text = "Geçerli DNS Sunucu " ' 'GroupBox3 ' Me.GroupBox3.Controls.Add(Me.AgMerkeziBtn) Me.GroupBox3.Controls.Add(Me.PMrkLbl) Me.GroupBox3.Controls.Add(Me.Label1) Me.GroupBox3.Controls.Add(Me.LinkLabel1) Me.GroupBox3.Location = New System.Drawing.Point(279, 294) Me.GroupBox3.Name = "GroupBox3" Me.GroupBox3.Size = New System.Drawing.Size(166, 133) Me.GroupBox3.TabIndex = 274 Me.GroupBox3.TabStop = False Me.GroupBox3.Text = "Ağ Paylaşım Merkezi" ' 'PictureBox1 ' Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image) Me.PictureBox1.Location = New System.Drawing.Point(299, 158) Me.PictureBox1.Name = "PictureBox1" Me.PictureBox1.Size = New System.Drawing.Size(133, 133) Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.PictureBox1.TabIndex = 275 Me.PictureBox1.TabStop = False ' 'AnaForm ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.BackColor = System.Drawing.SystemColors.InactiveCaption Me.ClientSize = New System.Drawing.Size(455, 431) Me.Controls.Add(Me.PictureBox1) Me.Controls.Add(Me.GroupBox3) Me.Controls.Add(Me.GroupBox2) Me.Controls.Add(Me.GroupBox1) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.MaximizeBox = False Me.Name = "AnaForm" Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual Me.Text = "DNS Gir" CType(Me.PictBul, System.ComponentModel.ISupportInitialize).EndInit() Me.GroupBox1.ResumeLayout(False) Me.GroupBox1.PerformLayout() Me.GroupBox2.ResumeLayout(False) Me.GroupBox3.ResumeLayout(False) Me.GroupBox3.PerformLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region #Region " PANO İŞLEMLERİ...." Private Const WM_DRAWCLIPBOARD As Integer = &H308 Private Const WM_CHANGECBCHAIN As Integer = &H30D Private mNextClipBoardViewerHWnd As IntPtr Private Event OnClipboardChanged()
_ Private Shared Function SetClipboardViewer(ByVal hWnd As IntPtr) As IntPtr End Function
_ Private Shared Function ChangeClipboardChain(ByVal hWnd As IntPtr, ByVal hWndNext As IntPtr) As _
Boolean End Function
_ Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As IntPtr, _ ByVal lParam As IntPtr) As IntPtr End Function Protected Overrides Sub WndProc(ByRef m As Message) Select Case m.Msg Case WM_DRAWCLIPBOARD RaiseEvent OnClipboardChanged() SendMessage(mNextClipBoardViewerHWnd, m.Msg, m.WParam, m.LParam) Case WM_CHANGECBCHAIN If m.WParam.Equals(mNextClipBoardViewerHWnd) Then mNextClipBoardViewerHWnd = m.LParam Else SendMessage(mNextClipBoardViewerHWnd, m.Msg, m.WParam, m.LParam) End If End Select MyBase.WndProc(m) End Sub 'Dışardan panoya alınan bilgi değişiklik Private Sub ClipBoardChanged() Try If dahiliPano = True Then Exit Sub If My.Computer.Clipboard.ContainsText Then PanodanAlınan = (My.Computer.Clipboard.GetText) Dim DnsNotu As String = (PanodanAlınan) '***************** panodan alınanı ayrıştır ********************* Dim sy As Integer sy = InStr(DnsNotu, "-") If sy = 0 Then Exit Sub DNS1_txt.Text = Mid(DnsNotu, 1, InStr(DnsNotu, "-") - 1) DNS2_txt.Text = Mid(DnsNotu, sy + 1, Len(DnsNotu)) 'Lw_EkleBtn.PerformClick() End If Catch ex As Exception MsgBox(ex.Message()) End Try End Sub #End Region #Region " FORM İŞLEMLERİ " Private Sub EditorForm_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed ChangeClipboardChain(Me.Handle, mNextClipBoardViewerHWnd) Me.Dispose() End Sub Private Sub EditorForm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If Me.WindowState = FormWindowState.Minimized Then Me.WindowState = vbNormal SaveSetting(Application.ProductName, "DnsGir", "üst", Me.Top) SaveSetting(Application.ProductName, "DnsGir", "sol", Me.Left) SaveSetting(Application.ProductName, "DnsGir", "eni", Me.Width) SaveSetting(Application.ProductName, "DnsGir", "boyu", Me.Height) End Sub Private Sub EditorForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load On Error Resume Next Me.Top = GetSetting(Application.ProductName, "DnsGir", "üst", 100) Me.Left = GetSetting(Application.ProductName, "DnsGir", "sol", 400) Call ListeYukle() mNextClipBoardViewerHWnd = SetClipboardViewer(Me.Handle) AddHandler Me.OnClipboardChanged, AddressOf ClipBoardChanged DnsGosterBtn.PerformClick() LinkLabel1.Links.Add(0, LinkLabel1.Text.Length, "http://192.168.2.1/main.html") End Sub #End Region #Region " LİSTVİEW LİSTESİNİ YÜKLE, GÜNCELLE SAKLA, AYNI KAYIT VAR MI...." Private Sub LstGüncelleBtn_Click(sender As System.Object, e As System.EventArgs) Handles LstGüncelleBtn.Click On Error GoTo hata Call ListeYukle() Dim index As Integer Dim eleman As ListViewItem 'Seçilen index liste güncellendiğinde aynı satırı seçmesi gerekir index = SecilenIndex.Text.ToString eleman = LwDNS.Items(index) eleman.Selected = True LwDNS.Focus() Exit Sub hata: SecilenIndex.Text = 0 Return End Sub Private Sub ListeYukle() On Error Resume Next LwDNS.Items.Clear() Dim XMLoku As New XmlTextReader(My.Application.Info.DirectoryPath & "\" & My.Settings.XmlFileName) XMLoku.MoveToContent() Dim ElementName As String = "" Dim NextItem As Boolean = True Dim objListViewItem As ListViewItem = Nothing Do While XMLoku.Read If NextItem Then objListViewItem = New ListViewItem NextItem = False End If Select Case XMLoku.NodeType Case XmlNodeType.Element ElementName = XMLoku.Name Case XmlNodeType.Text If ElementName = "DSN-1" Then objListViewItem.Text = XMLoku.Value End If If ElementName = "DSN-2" Then objListViewItem.SubItems.Add(XMLoku.Value) LwDNS.Items.Add(objListViewItem) NextItem = True End If End Select Loop XMLoku.Close() End Sub Public Sub Listeyikaydet() Dim XMLyaz As New XmlTextWriter(Application.StartupPath & My.Settings.XmlFileName, System.Text.Encoding.UTF8) With XMLyaz .Formatting = Formatting.Indented .WriteStartDocument() .WriteStartElement("WebSites") Dim ListViewNesnesi As New ListViewItem For Each ListViewNesnesi In LwDNS.Items .WriteStartElement("WebSite") .WriteElementString("DSN-1", ListViewNesnesi.Text) .WriteElementString("DSN-2", ListViewNesnesi.SubItems(1).Text) .WriteEndElement() Next .WriteEndElement() .WriteEndDocument() .Flush() .Close() End With SaklaBtn.Enabled = False End Sub Public Sub AyniKayitVarMi() Dim XMLoku As New XmlTextReader(My.Application.Info.DirectoryPath & "\" & My.Settings.XmlFileName) Dim x As Integer For x = 0 To LwDNS.Items.Count - 1 'sonn If LwDNS.Items(x).SubItems(0).Text & "-" & LwDNS.Items(x).SubItems(1).Text = DNS1_txt.Text & "-" & DNS2_txt.Text Then BuKayitVar = True LwDNS.Items(x).Selected = True Dim findItem As ListViewItem = LwDNS.FindItemWithText(LwDNS.Items(x).SubItems(0).Text) LwDNS.TopItem = findItem MsgBox("BU KAYIT ZATEN VAR") LwDNS.Focus() Exit Sub Else BuKayitVar = False End If Next End Sub Private Sub LwDNS_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles LwDNS.KeyDown If e.KeyCode = Keys.Delete Then SilBtn.PerformClick() End If If e.KeyCode = Keys.Escape Then Me.Close() End If End Sub Private Sub SilBtn_Click(sender As System.Object, e As System.EventArgs) Handles SilBtn.Click On Error Resume Next Dim indexes As ListView.SelectedIndexCollection = LwDNS.SelectedIndices Dim index As Integer DnsNotu.Clear() For Each index In indexes LwDNS.Items.RemoveAt(index) Next If index = 0 Then index = 0 index = index - 1 If index = -1 Then index = 0 ColumnHeader1.Text = "Dns-1 : " & "(" & index & " Kayıt sayısı)" ColumnHeader2.Text = "Dns-2 " & "(" & index & " .Satır seçili)" eleman = LwDNS.Items(index) eleman.Selected = True LwDNS.Focus() SaklaBtn.Enabled = True End Sub Private Sub SaklaBtn_Click(sender As System.Object, e As System.EventArgs) Handles SaklaBtn.Click Call Listeyikaydet() End Sub #End Region #Region " BUTON PANELİ İŞLEMLERİ (Panoya al, panoya yapıştır,ekle,Delete,Güncelle,.." Private Sub PanodanYapistirBtn_Click(sender As System.Object, e As System.EventArgs) Dim DnsNotu As String = (PanodanAlınan) '***************** panodan alınanı ayrıştır ********************* Dim sy As Integer sy = InStr(DnsNotu, "-") If sy = 0 Then Exit Sub DNS1_txt.Text = Mid(DnsNotu, 1, InStr(DnsNotu, "-") - 1) DNS2_txt.Text = Mid(DnsNotu, sy + 1, Len(DnsNotu)) Call AyniKayitVarMi() End Sub Private Sub EkleBtn_Click(sender As System.Object, e As System.EventArgs) If DNS1_txt.Text = "" Or DNS2_txt.Text = "" Then Exit Sub Dim item As New ListViewItem item.Text = DNS1_txt.Text.ToUpper item.SubItems.Add(DNS2_txt.Text) Call AyniKayitVarMi() If BuKayitVar = False Then LwDNS.Items.Add(item) End If LwDNS.Items(LwDNS.Items.Count - 1).Selected = True LwDNS.Sorting = SortOrder.Ascending 'indexi bulunduktan sonra liste sıralanır End Sub #End Region #Region "LİNK LİSTVİEW (ekle, DoubleClick, SelectedIndexChanged) İŞLEMLERİ.." Private Sub ekle() LwDNS.Sorting = SortOrder.None 'önce sırasız LW Dim item As New ListViewItem item.Text = DNS1_txt.Text 'dns1 item.SubItems.Add(DNS2_txt.Text) 'dns2) LwDNS.Items.Add(item) LwDNS.Items(LwDNS.Items.Count - 1).Selected = True LwDNS.Sorting = SortOrder.Ascending 'indexi bulunduktan sonra liste sıralanır 'ListView' e ekleneni Görünür alanda göstermek LwDNS.Items(LwDNS.Items.Count - 1).EnsureVisible() LwDNS.Focus() End Sub Private Sub Lw_EkleBtn_Click(sender As System.Object, e As System.EventArgs) Handles Lw_EkleBtn.Click Try Call AyniKayitVarMi() If BuKayitVar = False Then Call ekle() Catch ex As Exception MsgBox(ex.Message()) End Try End Sub Private Sub LwDNS_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LwDNS.SelectedIndexChanged Dim sayi As Integer = LwDNS.Items.Count Dim eleman As ListViewItem For i As Integer = 0 To sayi - 1 eleman = LwDNS.Items(i) If eleman.Selected Then 'seçeneklerle gösterilip iptal edilebilir DNS1_txt.Text = LwDNS.Items(i).SubItems(0).Text DNS2_txt.Text = LwDNS.Items(i).SubItems(1).Text SecilenIndex.Text = i ColumnHeader1.Text = "Kayıt " & "(" & sayi & ")" ColumnHeader2.Text = "Seçilen " & "(" & i + 1 & ")" End If Next SaklaBtn.Enabled = True End Sub #Region " LİSTE UYARI İŞLEMLERİ " Private Sub SiteNotu_MouseHover(sender As System.Object, e As System.EventArgs) Handles DnsNotu.MouseHover Dim tooltip As New ToolTip() tooltip.SetToolTip(DnsNotu, "Rakam girin") End Sub Private Sub LstGüncelleBtn_MouseHover(sender As System.Object, e As System.EventArgs) Handles LstGüncelleBtn.MouseHover Dim tooltip As New ToolTip() tooltip.SetToolTip(LstGüncelleBtn, "Listeyi Güncelle") End Sub Private Sub SilBtn_MouseHover(sender As System.Object, e As System.EventArgs) Handles SilBtn.MouseHover Dim tooltip As New ToolTip() tooltip.SetToolTip(SilBtn, "Seçili satırı Sil veya ESC ile sil") End Sub #End Region #End Region #Region " TOOLTİP UYARILARI (Balon yazı (Tooltip)" Private Sub SaklaBtn_MouseHover(sender As System.Object, e As System.EventArgs) Handles SaklaBtn.MouseHover Dim tooltip As New ToolTip() tooltip.SetToolTip(SaklaBtn, "Listeyi Sakla") End Sub #End Region #Region " LisView 'de ARA-BUL İŞLEMLERİ " Private Sub PictBul_Click(sender As System.Object, e As System.EventArgs) Handles PictBul.Click ''LİSTVİEW 'DE ARAMA For Each item As ListViewItem In LwDNS.Items item.BackColor = Color.Wheat 'SystemColors.Info ' Next If DnsNotu.Text = "" Then For Each item As ListViewItem In LwDNS.Items item.BackColor = Color.Wheat 'SystemColors.Info ' Next Else Dim findItem As ListViewItem = LwDNS.FindItemWithText(DnsNotu.Text) If findItem IsNot Nothing Then LwDNS.MultiSelect = False LwDNS.TopItem = findItem findItem.BackColor = Color.Pink DnsNotu.Text = "" End If End If End Sub Private Sub PictBul_MouseHover(sender As System.Object, e As System.EventArgs) Handles PictBul.MouseHover Dim tooltip As New ToolTip() tooltip.SetToolTip(PictBul, "Listede DNS Ara. " & vbCrLf & " ilk birkaç sayı girmek yeterli.") End Sub #End Region #Region " ARAMA ENTER TUŞU İŞLEMLERİ " Private Sub SiteNotu_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles DnsNotu.KeyDown If e.KeyCode = Keys.Enter Then PictBul_Click(sender, e) End If End Sub #End Region #Region " DURUM LABEL VE LİNKLABEL İŞLEMLERİ " Private Sub PMrkLbl_Click(sender As System.Object, e As System.EventArgs) Handles PMrkLbl.Click On Error Resume Next 'Ağ Paylaşım Merkezi kısa yol linkini açar Windows.Forms.Cursor.Current = Cursors.AppStarting Process.Start(PMrkLbl.Text) End Sub Private Sub AgMerkeziBtn_Click(sender As System.Object, e As System.EventArgs) Handles AgMerkeziBtn.Click 'win 10 için Ağ Paylaşım Merkezi kısa yol linkini açar Try PMrkLbl.Text = Application.StartupPath & "\Ağ ve Paylaşım Merkezi.lnk" PMrkLbl_Click(sender, e) Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub Private Sub LinkLabel1_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked If My.Computer.Network.IsAvailable = False Then MsgBox("Bilgisayarınız İnternete Bağlı Değil.") Exit Sub End If System.Diagnostics.Process.Start(e.Link.LinkData) End Sub #End Region #Region " BUTON İŞLEMLERİ " Private Sub DnsGosterBtn_Click(sender As System.Object, e As System.EventArgs) Handles DnsGosterBtn.Click Try If ListBox1.Items.Count > 0 Then KayitSilBtn.PerformClick() Dim Uzunluk As NetworkInterface() Dim DNSno As IPAddressCollection Uzunluk = NetworkInterface.GetAllNetworkInterfaces() For Each Adres As NetworkInterface In Uzunluk If (Adres.OperationalStatus = OperationalStatus.Up) Then DNSno = Adres.GetIPProperties().DnsAddresses For Each DNSGrup As IPAddress In DNSno ListBox1.Items.Add(DNSGrup.ToString()) Next End If Next Catch ex As Exception MsgBox(ex.Message()) End Try End Sub Private Sub KayitSilBtn_Click(sender As System.Object, e As System.EventArgs) Handles KayitSilBtn.Click Me.ListBox1.Items.Clear() End Sub Private Sub DnsAlBtn_Click(sender As System.Object, e As System.EventArgs) Handles DnsAlBtn.Click Try Dim reg As String = "SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces\" For Each x In Registry.LocalMachine.OpenSubKey(reg, True).GetSubKeyNames() For Each y In Registry.LocalMachine.OpenSubKey(reg & x & "\", True).GetValueNames If y = "NameServer" Then Registry.LocalMachine.OpenSubKey(reg & x & "\", True).SetValue(y, "192.168.2.1" & "," & "255.255.255.0") Next Next DnsGosterBtn.PerformClick() MsgBox("Dns Sunucu Adresi;" & vbCrLf & DNS1_txt.Text & "," & DNS2_txt.Text & vbCrLf & "olarak ayarlandı.") Catch ex As Exception MsgBox(ex.Message()) End Try End Sub #End Region #Region " ListView İŞLEMLERİ " Private Sub LwDNS_DoubleClick(sender As System.Object, e As System.EventArgs) Handles LwDNS.DoubleClick ' Registere Geçerli DNS olarak kaydet ve formda göster Try Dim reg As String = "SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces\" For Each x In Registry.LocalMachine.OpenSubKey(reg, True).GetSubKeyNames() For Each y In Registry.LocalMachine.OpenSubKey(reg & x & "\", True).GetValueNames If y = "NameServer" Then Registry.LocalMachine.OpenSubKey(reg & x & "\", True).SetValue(y, DNS1_txt.Text & "," & DNS2_txt.Text) Next Next ' Dns 'leri göster DnsGosterBtn.PerformClick() SaklaBtn.PerformClick() MsgBox("Dns Sunucu Adresi;" & vbCrLf & DNS1_txt.Text & "," & DNS2_txt.Text & vbCrLf & "olarak ayarlandı.") Catch ex As Exception MsgBox(ex.Message()) End Try End Sub Private Sub LwDNS_MouseHover(sender As System.Object, e As System.EventArgs) Handles LwDNS.MouseHover Dim tooltip As New ToolTip() tooltip.SetToolTip(LwDNS, "DNS Değiştirmek için Çift Tıkla") End Sub Private Sub LwDNS_Click(sender As System.Object, e As System.EventArgs) Handles LwDNS.Click For Each item As ListViewItem In LwDNS.Items item.BackColor = Color.Wheat ' SystemColors.Info Next End Sub #End Region Private Sub DNS1_txt_Click(sender As System.Object, e As System.EventArgs) Handles DNS1_txt.Click DNS1_txt.Text = Nothing DNS2_txt.Text = Nothing End Sub End Class
Modül1
Module Module1 Public PanodanAlınan As String Public dahiliPano As Boolean Public SecilenIndex As Integer Public BuKayitVar As Boolean = False Public dns1, dns2 As String End Module
1 yorum:
Erdoğan Aslan
6 Mayıs 2019 12:04
Kırık link güncellendi
Yanıtla
Sil
Yanıtlar
Yanıtla
Yorum ekle
Daha fazlasını yükle...
Sonraki Kayıt
Önceki Kayıt
Ana Sayfa
Kaydol:
Kayıt Yorumları (Atom)
Kırık link güncellendi
YanıtlaSil