📄 form1.vb
字号:
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
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
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button6 As System.Windows.Forms.Button
Friend WithEvents cbx1 As System.Windows.Forms.ComboBox
Friend WithEvents cbx0 As System.Windows.Forms.ComboBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Button7 As System.Windows.Forms.Button
Friend WithEvents Button8 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.Button2 = New System.Windows.Forms.Button
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.Button3 = New System.Windows.Forms.Button
Me.RichTextBox1 = New System.Windows.Forms.RichTextBox
Me.Button4 = New System.Windows.Forms.Button
Me.Button5 = New System.Windows.Forms.Button
Me.Button6 = New System.Windows.Forms.Button
Me.cbx1 = New System.Windows.Forms.ComboBox
Me.cbx0 = New System.Windows.Forms.ComboBox
Me.Label2 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.Button7 = New System.Windows.Forms.Button
Me.Button8 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(374, 79)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(154, 26)
Me.Button1.TabIndex = 0
Me.Button1.Text = "read_macf读网卡当前mac"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(200, 80)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(168, 21)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(200, 114)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(168, 21)
Me.TextBox2.TabIndex = 3
Me.TextBox2.Text = ""
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(373, 114)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(155, 24)
Me.Button2.TabIndex = 4
Me.Button2.Text = "read_mact读网卡真实mac"
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(200, 152)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(168, 21)
Me.TextBox3.TabIndex = 5
Me.TextBox3.Text = ""
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(374, 152)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(154, 23)
Me.Button3.TabIndex = 6
Me.Button3.Text = "修改网卡mac"
'
'RichTextBox1
'
Me.RichTextBox1.Location = New System.Drawing.Point(16, 184)
Me.RichTextBox1.Name = "RichTextBox1"
Me.RichTextBox1.Size = New System.Drawing.Size(672, 184)
Me.RichTextBox1.TabIndex = 7
Me.RichTextBox1.Text = "本软件未注册!您只能免费使用5次!,为了方便您使用请您及时注册! 注册费:xxxxxx元" & Microsoft.VisualBasic.ChrW(10) & "注册方法:" & Microsoft.VisualBasic.ChrW(10) & " 1、将注册费汇入: 中国工商银行(www.icbc" & _
".com.cn)灵通卡" & Microsoft.VisualBasic.ChrW(10) & " 卡 号:xxxxxx xxxxxx xxxxxx xxxxxxx" & Microsoft.VisualBasic.ChrW(10) & " 户 名:xxx " & Microsoft.VisualBasic.ChrW(10) & " 2、将" & _
"产品序列号、汇款人姓名、汇款金额等通过E-Mail、短信或QQ发给我们;" & Microsoft.VisualBasic.ChrW(10) & " 3、收到注册费和产品序列号后,我们会在一个工作日内告知您该产品的注册号;" & Microsoft.VisualBasic.ChrW(10) & " 4、" & _
"输入注册号,点击注册按钮即可完成注册。" & Microsoft.VisualBasic.ChrW(10) & "联系电话:xxxxxx" & Microsoft.VisualBasic.ChrW(10) & "电子邮件:xxxxx@xxxx.xxx" & Microsoft.VisualBasic.ChrW(10) & "网 址:http://xxxxx.xxxxx.xx" & _
"xxx"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(328, 376)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(104, 32)
Me.Button4.TabIndex = 8
Me.Button4.Text = "reg_inf"
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(541, 113)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(155, 23)
Me.Button5.TabIndex = 10
Me.Button5.Text = "read_mac读网卡真实mac"
'
'Button6
'
Me.Button6.Location = New System.Drawing.Point(540, 81)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(156, 23)
Me.Button6.TabIndex = 9
Me.Button6.Text = "read_mac读网卡当前mac"
'
'cbx1
'
Me.cbx1.Items.AddRange(New Object() {"1", "2", "3", "4"})
Me.cbx1.Location = New System.Drawing.Point(131, 80)
Me.cbx1.Name = "cbx1"
Me.cbx1.Size = New System.Drawing.Size(56, 20)
Me.cbx1.TabIndex = 12
Me.cbx1.Text = "1"
'
'cbx0
'
Me.cbx0.Items.AddRange(New Object() {"逻辑网卡序号:", "物理网卡序号:"})
Me.cbx0.Location = New System.Drawing.Point(17, 80)
Me.cbx0.Name = "cbx0"
Me.cbx0.Size = New System.Drawing.Size(109, 20)
Me.cbx0.TabIndex = 15
Me.cbx0.Text = "逻辑网卡序号:"
'
'Label2
'
Me.Label2.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label2.Location = New System.Drawing.Point(21, 23)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(120, 18)
Me.Label2.TabIndex = 17
Me.Label2.Text = "当前网卡名称:"
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label1.Location = New System.Drawing.Point(120, 20)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(576, 28)
Me.Label1.TabIndex = 18
Me.Label1.Text = "Label1"
'
'Button7
'
Me.Button7.Location = New System.Drawing.Point(208, 51)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(154, 26)
Me.Button7.TabIndex = 19
Me.Button7.Text = "清除"
'
'Button8
'
Me.Button8.Location = New System.Drawing.Point(542, 151)
Me.Button8.Name = "Button8"
Me.Button8.Size = New System.Drawing.Size(154, 25)
Me.Button8.TabIndex = 20
Me.Button8.Text = "恢复网卡真实MAC"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(704, 413)
Me.Controls.Add(Me.Button8)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.cbx0)
Me.Controls.Add(Me.cbx1)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.RichTextBox1)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Declare Function netcard_Description Lib "set_mac.dll" Alias "netcard_Description" (ByVal i As Integer) As String
Declare Function netcardt_count Lib "set_mac.dll" Alias "netcardt_count" () As Integer
Declare Function netcardf_count Lib "set_mac.dll" Alias "netcardf_count" () As Integer
Declare Function read_mac Lib "set_mac.dll" Alias "read_mac" (ByVal i As Integer, ByVal ft As Boolean) As String
Declare Function read_mact Lib "set_mac.dll" Alias "read_mact" (ByVal i As Integer) As String
Declare Function read_macf Lib "set_mac.dll" Alias "read_macf" (ByVal i As Integer) As String
Declare Function write_mac Lib "set_mac.dll" Alias "write_mac" (ByVal i As Integer, ByVal macstr As String) As Integer
Declare Function set_real_mac Lib "set_mac.dll" Alias "set_real_mac" (ByVal i As Integer) As Integer
Declare Function reg_inf Lib "set_mac.dll" Alias "reg_inf" (ByVal redit As String) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = read_macf(cbx1.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox2.Text = read_mact(cbx1.Text)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If write_mac(cbx1.Text, TextBox3.Text) = 1 Then
MessageBox.Show("ok!.", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
MessageBox.Show("no!.", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim ss As String
ss = RichTextBox1.Text
reg_inf(RichTextBox1.Text)
RichTextBox1.ResetText()
RichTextBox1.Text = ss
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
TextBox1.Text = read_mac(cbx1.Text, False)
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
TextBox2.Text = read_mac(cbx1.Text, True)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer
cbx1.Items.Clear()
If cbx0.Text = "逻辑网卡序号:" Then
If netcardf_count() >= 0 Then
For i = 1 To netcardf_count() Step 1
cbx1.Items.Add(i)
Next
End If
ElseIf cbx0.Text = "物理网卡序号:" Then
If netcardt_count() >= 0 Then
For i = 1 To netcardt_count() Step 1
cbx1.Items.Add(i)
Next
End If
End If
Label1.Text = netcard_Description(cbx1.Text)
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbx0.SelectedIndexChanged
Dim i As Integer
cbx1.Items.Clear()
If cbx0.Text = "逻辑网卡序号:" Then
If netcardf_count() >= 0 Then
For i = 1 To netcardf_count() Step 1
cbx1.Items.Add(i)
Next
End If
ElseIf cbx0.Text = "物理网卡序号:" Then
If netcardt_count() >= 0 Then
For i = 1 To netcardt_count() Step 1
cbx1.Items.Add(i)
Next
End If
End If
End Sub
Private Sub cbx1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbx1.SelectedIndexChanged
Label1.Text = netcard_Description(cbx1.Text)
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If set_real_mac(cbx1.Text) = 1 Then
MessageBox.Show("ok!.", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
MessageBox.Show("false!.", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -