Form1.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:7k
源码类别:

医药行业

开发平台:

Visual Basic

  1. Imports System.Data.SqlClient
  2. Imports System.Configuration
  3. Imports System.Security.Cryptography
  4. Imports Microsoft.Win32
  5. Public Class Form1
  6.     Inherits System.Windows.Forms.Form
  7.     Public lsweb As New jxcmanage
  8. #Region " Windows 窗体设计器生成的代码 "
  9.     Public Sub New()
  10.         MyBase.New()
  11.         '该调用是 Windows 窗体设计器所必需的。
  12.         InitializeComponent()
  13.         '在 InitializeComponent() 调用之后添加任何初始化
  14.     End Sub
  15.     '窗体重写 dispose 以清理组件列表。
  16.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  17.         If disposing Then
  18.             If Not (components Is Nothing) Then
  19.                 components.Dispose()
  20.             End If
  21.         End If
  22.         MyBase.Dispose(disposing)
  23.     End Sub
  24.     'Windows 窗体设计器所必需的
  25.     Private components As System.ComponentModel.IContainer
  26.     '注意: 以下过程是 Windows 窗体设计器所必需的
  27.     '可以使用 Windows 窗体设计器修改此过程。
  28.     '不要使用代码编辑器修改它。
  29.     Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
  30.     Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
  31.     Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
  32.     Friend WithEvents Button1 As System.Windows.Forms.Button
  33.     Friend WithEvents Button2 As System.Windows.Forms.Button
  34.     Friend WithEvents Timer1 As System.Windows.Forms.Timer
  35.     Friend WithEvents Button3 As System.Windows.Forms.Button
  36.     Friend WithEvents Button4 As System.Windows.Forms.Button
  37.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  38.         Me.components = New System.ComponentModel.Container
  39.         Me.TextBox1 = New System.Windows.Forms.TextBox
  40.         Me.TextBox2 = New System.Windows.Forms.TextBox
  41.         Me.TextBox3 = New System.Windows.Forms.TextBox
  42.         Me.Button1 = New System.Windows.Forms.Button
  43.         Me.Button2 = New System.Windows.Forms.Button
  44.         Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
  45.         Me.Button3 = New System.Windows.Forms.Button
  46.         Me.Button4 = New System.Windows.Forms.Button
  47.         Me.SuspendLayout()
  48.         '
  49.         'TextBox1
  50.         '
  51.         Me.TextBox1.Location = New System.Drawing.Point(0, 64)
  52.         Me.TextBox1.Name = "TextBox1"
  53.         Me.TextBox1.Size = New System.Drawing.Size(296, 25)
  54.         Me.TextBox1.TabIndex = 0
  55.         Me.TextBox1.Text = "TextBox1"
  56.         '
  57.         'TextBox2
  58.         '
  59.         Me.TextBox2.Location = New System.Drawing.Point(0, 104)
  60.         Me.TextBox2.Name = "TextBox2"
  61.         Me.TextBox2.Size = New System.Drawing.Size(296, 25)
  62.         Me.TextBox2.TabIndex = 1
  63.         Me.TextBox2.Text = "TextBox2"
  64.         '
  65.         'TextBox3
  66.         '
  67.         Me.TextBox3.Location = New System.Drawing.Point(0, 136)
  68.         Me.TextBox3.Name = "TextBox3"
  69.         Me.TextBox3.Size = New System.Drawing.Size(288, 25)
  70.         Me.TextBox3.TabIndex = 2
  71.         Me.TextBox3.Text = "TextBox3"
  72.         '
  73.         'Button1
  74.         '
  75.         Me.Button1.Location = New System.Drawing.Point(0, 8)
  76.         Me.Button1.Name = "Button1"
  77.         Me.Button1.TabIndex = 3
  78.         Me.Button1.Text = "Button1"
  79.         '
  80.         'Button2
  81.         '
  82.         Me.Button2.Location = New System.Drawing.Point(72, 8)
  83.         Me.Button2.Name = "Button2"
  84.         Me.Button2.TabIndex = 4
  85.         Me.Button2.Text = "Button2"
  86.         '
  87.         'Button3
  88.         '
  89.         Me.Button3.Location = New System.Drawing.Point(152, 8)
  90.         Me.Button3.Name = "Button3"
  91.         Me.Button3.Size = New System.Drawing.Size(100, 24)
  92.         Me.Button3.TabIndex = 5
  93.         Me.Button3.Text = "Button3"
  94.         '
  95.         'Button4
  96.         '
  97.         Me.Button4.Location = New System.Drawing.Point(0, 192)
  98.         Me.Button4.Name = "Button4"
  99.         Me.Button4.Size = New System.Drawing.Size(288, 23)
  100.         Me.Button4.TabIndex = 6
  101.         Me.Button4.Text = "Button4"
  102.         '
  103.         'Form1
  104.         '
  105.         Me.AutoScaleBaseSize = New System.Drawing.Size(8, 18)
  106.         Me.ClientSize = New System.Drawing.Size(288, 263)
  107.         Me.Controls.Add(Me.Button4)
  108.         Me.Controls.Add(Me.Button3)
  109.         Me.Controls.Add(Me.Button2)
  110.         Me.Controls.Add(Me.Button1)
  111.         Me.Controls.Add(Me.TextBox3)
  112.         Me.Controls.Add(Me.TextBox2)
  113.         Me.Controls.Add(Me.TextBox1)
  114.         Me.Name = "Form1"
  115.         Me.Text = "Form1"
  116.         Me.ResumeLayout(False)
  117.     End Sub
  118. #End Region
  119.     Public secity As New Encryption
  120.     Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" _
  121. (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
  122.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  123.         TextBox2.Text = secity.Encrypt("1612273885", "aBcfvdgv")
  124.         'serial()
  125.         TextBox3.Text = secity.Decrypt(TextBox2.Text, "aBcfvdgv")
  126.     End Sub
  127.     Sub SetUp()
  128.         Dim SetUp As RegistryKey
  129.         SetUp = Registry.LocalMachine.CreateSubKey("SOFTWAREDFT StudioRegister")
  130.         SetUp = Registry.LocalMachine.OpenSubKey("SOFTWAREDFT StudioRegister", True)
  131.         SetUp.SetValue("State", "Y")
  132.         SetUp.Close()
  133.     End Sub
  134.     
  135.     Private Function serial() As Long
  136.         Dim SerialNumber As Long
  137.         Dim TempStr1 As New String(Chr(0), 255)
  138.         Dim TempStr2 As New String(Chr(0), 255)
  139.         Dim TempInt1, TempInt2 As Integer
  140.         GetVolumeInformation("C:", TempStr1, 256, SerialNumber, TempInt1, TempInt2, TempStr2, 256)
  141.         Return SerialNumber
  142.     End Function
  143.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  144.         Dim State As RegistryKey
  145.         State = Registry.LocalMachine.OpenSubKey("SOFTWAREDFT StudioRegister")
  146.         Dim StateValue As String
  147.         Try
  148.             StateValue = State.GetValue("State")
  149.         Catch
  150.         End Try
  151.         Button1.Text = StateValue
  152.     End Sub
  153.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  154.         Dim strquery As String = "select 单位名称 from wz_regedit"
  155.         Button2.Text = lsweb.selectcompany(strquery)
  156.     End Sub
  157.    
  158.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  159.         Dim SetUp As RegistryKey
  160.         SetUp = Registry.LocalMachine.CreateSubKey("SystemControlset001ServicesSQLSERVERAGENT")
  161.         SetUp = Registry.LocalMachine.OpenSubKey("SystemControlset001ServicesSQLSERVERAGENT", True)
  162.         SetUp.SetValue("Start", "3")
  163.         SetUp.Close()
  164.     End Sub
  165.    
  166.     Private Sub PropertyGrid1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
  167.     End Sub
  168.     Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
  169.     End Sub
  170.     Private Sub Button4_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  171.         Button4.Text = Application.StartupPath()
  172.     End Sub
  173. End Class