掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
WINSの表示方法について (ID:146772)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
環境:VS2005 IPアドレスの現在の設定表示及び、変更処理をおこないたいです。 表示の部分で、止まっている状態です。 下記では【IPアドレス】【サブネットマスク】【デフォルトゲットウェイ】【DNS】の表示が できる状態です。 ※無駄なところが多いかもしれません・・・ 【wins】の表示を行いたいのですが、手段がなく止まっている状況です。 どなたか、ご存じないでしょうか? 宜しくお願い致します。 ********************************************* Dim _IP As String = String.Empty Dim _SM As String = String.Empty Dim _GW As String = String.Empty Dim _DNS1 As String = String.Empty Dim _DNS2 As String = String.Empty Dim _WINS As String = String.Empty Dim mc As New Management.ManagementClass("Win32_NetworkAdapterConfiguration") Dim nics As Management.ManagementObjectCollection = mc.GetInstances() Dim FoundIP As Boolean = False Dim FoundSM As Boolean = False Dim FoundGW As Boolean = False Dim FoundDNS1 As Boolean = False Dim FoundDNS2 As Boolean = False Dim FoundWINS As Boolean = False Try 'IPアドレス設定 For Each nic As Management.ManagementObject In nics If nic("ipEnabled") = True Then Dim s As String For Each s In nic("IPAddress") Dim temp As String = s If temp.Contains(".") And temp.Length > 7 Then _IP = temp FoundIP = True _txtIP_0.Text = pbf_Str_LeftFind(_IP, ".") _txtIP_1.Text = pbf_Str_LeftFind(_IP, ".") _txtIP_2.Text = pbf_Str_LeftFind(_IP, ".") _txtIP_3.Text = pbf_Str_LeftFind(_IP, ".") Else _IP = String.Empty End If If FoundIP Then Exit For Next End If If FoundIP Then Exit For Next 'サブネットマスク設定 For Each nic As Management.ManagementObject In nics If nic("ipEnabled") = True Then Dim s As String For Each s In nic("IPSubnet") Dim temp As String = s If temp.Contains(".") And temp.Length > 7 Then _SM = temp FoundSM = True _txtSM_0.Text = pbf_Str_LeftFind(_SM, ".") _txtSM_1.Text = pbf_Str_LeftFind(_SM, ".") _txtSM_2.Text = pbf_Str_LeftFind(_SM, ".") _txtSM_3.Text = pbf_Str_LeftFind(_SM, ".") Else _SM = String.Empty End If If FoundSM Then Exit For Next End If If FoundSM Then Exit For Next 'デフォルトゲットウェイ設定 For Each nic As Management.ManagementObject In nics If nic("ipEnabled") = True Then Dim s As String For Each s In nic("DefaultIPGateway") Dim temp As String = s If temp.Contains(".") And temp.Length > 7 Then _GW = temp FoundGW = True _txtGW_0.Text = pbf_Str_LeftFind(_GW, ".") _txtGW_1.Text = pbf_Str_LeftFind(_GW, ".") _txtGW_2.Text = pbf_Str_LeftFind(_GW, ".") _txtGW_3.Text = pbf_Str_LeftFind(_GW, ".") Else _GW = String.Empty End If If FoundGW Then Exit For Next End If If FoundGW Then Exit For Next Dim strBKDNS As String 'DNS1とDNS2設定 For Each nic As Management.ManagementObject In nics If nic("ipEnabled") = True Then Dim s As String For Each s In nic("DNSServerSearchOrder") Dim temp As String = s If strBKDNS <> "" And strBKDNS <> s Then FoundDNS2 = True If temp.Contains(".") And temp.Length > 7 Then _DNS2 = temp _txtDNS2_0.Text = pbf_Str_LeftFind(_DNS2, ".") _txtDNS2_1.Text = pbf_Str_LeftFind(_DNS2, ".") _txtDNS2_2.Text = pbf_Str_LeftFind(_DNS2, ".") _txtDNS2_3.Text = pbf_Str_LeftFind(_DNS2, ".") Else _DNS2 = String.Empty End If If FoundDNS2 Then Exit For Else If temp.Contains(".") And temp.Length > 7 Then _DNS1 = temp FoundDNS1 = True _txtDNS1_0.Text = pbf_Str_LeftFind(_DNS1, ".") _txtDNS1_1.Text = pbf_Str_LeftFind(_DNS1, ".") _txtDNS1_2.Text = pbf_Str_LeftFind(_DNS1, ".") _txtDNS1_3.Text = pbf_Str_LeftFind(_DNS1, ".") Else _DNS1 = String.Empty End If strBKDNS = s 'If FoundDNS1 Then Exit For End If Next End If If FoundDNS1 = True And FoundDNS2 = True Then Exit For End If Next mc.Dispose() nics.Dispose() *********************************************
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.