Form1.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:7k
- Imports System.Data.SqlClient
- Imports System.Configuration
- Imports System.Security.Cryptography
- Imports Microsoft.Win32
- Public Class Form1
- Inherits System.Windows.Forms.Form
- Public lsweb As New jxcmanage
- #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 TextBox1 As System.Windows.Forms.TextBox
- Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
- Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
- Friend WithEvents Button1 As System.Windows.Forms.Button
- Friend WithEvents Button2 As System.Windows.Forms.Button
- Friend WithEvents Timer1 As System.Windows.Forms.Timer
- Friend WithEvents Button3 As System.Windows.Forms.Button
- Friend WithEvents Button4 As System.Windows.Forms.Button
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.components = New System.ComponentModel.Container
- Me.TextBox1 = New System.Windows.Forms.TextBox
- Me.TextBox2 = New System.Windows.Forms.TextBox
- Me.TextBox3 = New System.Windows.Forms.TextBox
- Me.Button1 = New System.Windows.Forms.Button
- Me.Button2 = New System.Windows.Forms.Button
- Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
- Me.Button3 = New System.Windows.Forms.Button
- Me.Button4 = New System.Windows.Forms.Button
- Me.SuspendLayout()
- '
- 'TextBox1
- '
- Me.TextBox1.Location = New System.Drawing.Point(0, 64)
- Me.TextBox1.Name = "TextBox1"
- Me.TextBox1.Size = New System.Drawing.Size(296, 25)
- Me.TextBox1.TabIndex = 0
- Me.TextBox1.Text = "TextBox1"
- '
- 'TextBox2
- '
- Me.TextBox2.Location = New System.Drawing.Point(0, 104)
- Me.TextBox2.Name = "TextBox2"
- Me.TextBox2.Size = New System.Drawing.Size(296, 25)
- Me.TextBox2.TabIndex = 1
- Me.TextBox2.Text = "TextBox2"
- '
- 'TextBox3
- '
- Me.TextBox3.Location = New System.Drawing.Point(0, 136)
- Me.TextBox3.Name = "TextBox3"
- Me.TextBox3.Size = New System.Drawing.Size(288, 25)
- Me.TextBox3.TabIndex = 2
- Me.TextBox3.Text = "TextBox3"
- '
- 'Button1
- '
- Me.Button1.Location = New System.Drawing.Point(0, 8)
- Me.Button1.Name = "Button1"
- Me.Button1.TabIndex = 3
- Me.Button1.Text = "Button1"
- '
- 'Button2
- '
- Me.Button2.Location = New System.Drawing.Point(72, 8)
- Me.Button2.Name = "Button2"
- Me.Button2.TabIndex = 4
- Me.Button2.Text = "Button2"
- '
- 'Button3
- '
- Me.Button3.Location = New System.Drawing.Point(152, 8)
- Me.Button3.Name = "Button3"
- Me.Button3.Size = New System.Drawing.Size(100, 24)
- Me.Button3.TabIndex = 5
- Me.Button3.Text = "Button3"
- '
- 'Button4
- '
- Me.Button4.Location = New System.Drawing.Point(0, 192)
- Me.Button4.Name = "Button4"
- Me.Button4.Size = New System.Drawing.Size(288, 23)
- Me.Button4.TabIndex = 6
- Me.Button4.Text = "Button4"
- '
- 'Form1
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(8, 18)
- Me.ClientSize = New System.Drawing.Size(288, 263)
- Me.Controls.Add(Me.Button4)
- Me.Controls.Add(Me.Button3)
- Me.Controls.Add(Me.Button2)
- Me.Controls.Add(Me.Button1)
- Me.Controls.Add(Me.TextBox3)
- Me.Controls.Add(Me.TextBox2)
- Me.Controls.Add(Me.TextBox1)
- Me.Name = "Form1"
- Me.Text = "Form1"
- Me.ResumeLayout(False)
- End Sub
- #End Region
- Public secity As New Encryption
- Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" _
- (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Integer, ByRef lpVolumeSerialNumber As Long, ByVal lpMaximumComponentLength As Integer, ByVal lpFileSystemFlags As Integer, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Integer) As Integer
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- TextBox2.Text = secity.Encrypt("1612273885", "aBcfvdgv")
- 'serial()
- TextBox3.Text = secity.Decrypt(TextBox2.Text, "aBcfvdgv")
- End Sub
- Sub SetUp()
- Dim SetUp As RegistryKey
- SetUp = Registry.LocalMachine.CreateSubKey("SOFTWAREDFT StudioRegister")
- SetUp = Registry.LocalMachine.OpenSubKey("SOFTWAREDFT StudioRegister", True)
- SetUp.SetValue("State", "Y")
- SetUp.Close()
- End Sub
-
- Private Function serial() As Long
- Dim SerialNumber As Long
- Dim TempStr1 As New String(Chr(0), 255)
- Dim TempStr2 As New String(Chr(0), 255)
- Dim TempInt1, TempInt2 As Integer
- GetVolumeInformation("C:", TempStr1, 256, SerialNumber, TempInt1, TempInt2, TempStr2, 256)
- Return SerialNumber
- End Function
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim State As RegistryKey
- State = Registry.LocalMachine.OpenSubKey("SOFTWAREDFT StudioRegister")
- Dim StateValue As String
- Try
- StateValue = State.GetValue("State")
- Catch
- End Try
- Button1.Text = StateValue
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Dim strquery As String = "select 单位名称 from wz_regedit"
- Button2.Text = lsweb.selectcompany(strquery)
- End Sub
-
- Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
- Dim SetUp As RegistryKey
- SetUp = Registry.LocalMachine.CreateSubKey("SystemControlset001ServicesSQLSERVERAGENT")
- SetUp = Registry.LocalMachine.OpenSubKey("SystemControlset001ServicesSQLSERVERAGENT", True)
- SetUp.SetValue("Start", "3")
- SetUp.Close()
- End Sub
-
- Private Sub PropertyGrid1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
- End Sub
- Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
- End Sub
- Private Sub Button4_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
- Button4.Text = Application.StartupPath()
- End Sub
- End Class