📄 frmmain.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form FrmMain
BackColor = &H80000009&
Caption = "IP管理工具"
ClientHeight = 8145
ClientLeft = 60
ClientTop = 2640
ClientWidth = 11460
Icon = "FrmMain.frx":0000
LinkTopic = "Form1"
Picture = "FrmMain.frx":47C4A
ScaleHeight = 8145
ScaleWidth = 11460
Begin MSComctlLib.ImageList ImageList2
Left = 1170
Top = 1740
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 24
ImageHeight = 24
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":8F894
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":8FFA8
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":906BC
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":90DD0
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":914E4
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList ImageList1
Left = 2010
Top = 1290
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 3
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":91BF8
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":91F4C
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":922A0
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar TbMenu
Align = 1 'Align Top
Height = 480
Left = 0
TabIndex = 0
Top = 0
Width = 11460
_ExtentX = 20214
_ExtentY = 847
ButtonWidth = 2196
ButtonHeight = 794
Appearance = 1
Style = 1
TextAlignment = 1
ImageList = "ImageList2"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 10
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "添加实例"
Key = "tooAdd"
Object.ToolTipText = "添加实例"
ImageIndex = 1
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "编辑实例"
Key = "tooEdit"
Object.ToolTipText = "编辑实例"
ImageIndex = 2
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除实例"
Key = "tooDelete"
Object.ToolTipText = "删除实例"
ImageIndex = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "激活IP"
Key = "tooSendIP"
Object.ToolTipText = "激活IP"
ImageIndex = 4
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "复位"
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Ping"
Key = "tooPing"
Object.ToolTipText = "Ping"
ImageIndex = 5
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "tooExit"
Object.ToolTipText = "退出"
ImageIndex = 4
EndProperty
EndProperty
End
Begin MSComctlLib.StatusBar SBState
Align = 2 'Align Bottom
Height = 285
Left = 0
TabIndex = 1
Top = 7860
Width = 11460
_ExtentX = 20214
_ExtentY = 503
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 8
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 1411
MinWidth = 1411
Text = "作者"
TextSave = "作者"
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Text = "清风工作室"
TextSave = "清风工作室"
Object.ToolTipText = "清风工作室"
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 3528
MinWidth = 3528
EndProperty
BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 7056
MinWidth = 7056
EndProperty
BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 1834
MinWidth = 1834
Text = "Email:"
TextSave = "Email:"
EndProperty
BeginProperty Panel6 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 3528
MinWidth = 3528
Text = "zqf1979@gmail.com"
TextSave = "zqf1979@gmail.com"
Object.ToolTipText = "zqf1979@gmail.com"
EndProperty
BeginProperty Panel7 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Panel8 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 6068
MinWidth = 6068
EndProperty
EndProperty
End
Begin MSComctlLib.ListView LVIP
Height = 9675
Left = 30
TabIndex = 2
Top = 510
Width = 11415
_ExtentX = 20135
_ExtentY = 17066
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
Checkboxes = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
Icons = "ImageList1"
SmallIcons = "ImageList1"
ColHdrIcons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 0
NumItems = 0
End
Begin VB.Menu MenuOperation
Caption = "操作[&C]"
Begin VB.Menu MenuAdd
Caption = "新增实例"
End
Begin VB.Menu MenuEdit
Caption = "编辑实例"
End
Begin VB.Menu MenuDelete
Caption = "删除实例"
End
Begin VB.Menu menusplit
Caption = "-"
End
Begin VB.Menu menuSendIP
Caption = "激活IP"
End
Begin VB.Menu menuDiaplasis
Caption = "复位"
End
Begin VB.Menu menuping
Caption = "Ping"
End
Begin VB.Menu menusplit2
Caption = "-"
End
Begin VB.Menu menuexit
Caption = "退出"
End
End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim CLV As CListView
Dim sComputer As String
Dim oWMIService As Object
Dim cNetAdapters As Object
Dim sIPAddress As Variant
Dim sSubnetMask As Variant
Dim sGateway As Variant
Dim sGatewaymetric As Variant
Dim sDNSServers As Variant
Dim sWINSPriServer As String
Dim sWINSSecServer As String
Dim oNetAdapter As Object
Dim bErr As Boolean
Dim IPConfigSet As Object
Dim IPConfig As Object
Const DHCP_NOT_ENABLED = 0
Const DHCP_ENABLED = -1
Const DHCP_CANCEL = -2
Rem Array that will contains profile settings
Dim sAr() As String
Private Sub Form_Load()
Set CLV = New CListView
CLV.Attach LVIP
Call InitList
Set CIni = New CINIOpeartion
CIni.FileName = App.Path & "\" & "PROFILES.INI"
Call InitProfiles
Call SetResize
End Sub
Private Sub Form_Resize()
Call SetResize
End Sub
Private Sub SetResize()
LVIP.Width = Me.ScaleWidth - LVIP.Left - 50
LVIP.Height = Me.ScaleHeight - LVIP.Top - 300
End Sub
Private Sub InitList()
Dim strHead As String
CLV.Clear
strHead = "当前实例|实例名|IP地址|子网掩码|默认网关|首选DNS|备用DNS|状态"
CLV.setHead strHead
CLV.SetWidth 1500
LVIP.ColumnHeaders(1).Width = 1000
LVIP.ColumnHeaders(2).Width = 1800
End Sub
Private Sub InitProfiles()
Dim sProfile As String
Dim sKey() As String
Dim i%, iCount%, j%, iPos%
Dim strProfileValues As String
Dim arrValues() As String
Dim strIPValues As String
sProfile = CIni.GetIniString("CurrentProfile", "ProfileName", CIni.FileName)
'sProfile = CIni.ReadString("CurrentProfile", "ProfileName", "")
CIni.ReadSection CIni.FileName, INI_SECTION_PROFILES, sKey(), CLng(iCount)
If UBound(sKey) = 0 Then Exit Sub
LVIP.ListItems.Clear
For i = 1 To UBound(sKey)
'strProfileValues = CIni.ReadString(INI_SECTION_PROFILES, sKey(i), "")
strProfileValues = CIni.GetIniString(INI_SECTION_PROFILES, sKey(i), CIni.FileName)
arrValues = Split(strProfileValues, ".")
If UBound(arrValues) = 0 Then Exit Sub
'先把第一个节点名称加入
strProfileValues = sKey(i) & "|"
For j = 0 To UBound(arrValues)
If (j + 1) Mod 4 = 0 Then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -