⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmclearmutex.frm

📁 一个用VB写的财务软件源码
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmClearMutex 
   Caption         =   "清除互斥状态"
   ClientHeight    =   4305
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7605
   Icon            =   "frmClearMutex.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   4305
   ScaleWidth      =   7605
   StartUpPosition =   2  '屏幕中心
   Begin MSComctlLib.ListView lvw 
      Height          =   3660
      Left            =   45
      TabIndex        =   2
      Top             =   45
      Width           =   7485
      _ExtentX        =   13203
      _ExtentY        =   6456
      SortKey         =   1
      View            =   3
      Arrange         =   1
      LabelEdit       =   1
      Sorted          =   -1  'True
      MultiSelect     =   -1  'True
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      FullRowSelect   =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   3
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Text            =   "主机名(IP地址)"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   1
         Text            =   "子系统代码"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   2
         Text            =   "账套代码"
         Object.Width           =   2540
      EndProperty
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退出"
      Height          =   330
      Left            =   6210
      TabIndex        =   1
      Top             =   3915
      Width           =   1140
   End
   Begin VB.CommandButton cmdClear 
      Caption         =   "清除"
      Height          =   375
      Left            =   4410
      TabIndex        =   0
      Top             =   3870
      Width           =   1140
   End
   Begin VB.Label Label1 
      Caption         =   "按住Shift可以连续选择;按住Ctrl可以多选"
      Height          =   375
      Left            =   540
      TabIndex        =   3
      Top             =   3825
      Width           =   2130
   End
End
Attribute VB_Name = "frmClearMutex"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


Private Sub cmdClear_Click()
Dim itm As ListItem
Dim i As Integer
Dim j As Integer
gloSys.cnnSys.BeginTrans
i = 1
While i < lVw.ListItems.Count + 1
    Set itm = lVw.ListItems(i)
    If itm.Selected = True Then
        gloSys.cnnSys.Execute "Delete from tSYS_MutexObjectStatus where IP='" + itm.text + _
            "' and SubSysID='" + itm.SubItems(1) + "' and AccountID='" + itm.SubItems(2) + "'"
        gloSys.cnnSys.Execute "Delete from tSYS_MutexStatus where IP='" + itm.text + _
            "' and SubSysID='" + itm.SubItems(1) + "' and AccountID='" + itm.SubItems(2) + "'"
        lVw.ListItems.Remove itm.Key
    End If
    i = i + 1
Wend
gloSys.cnnSys.CommitTrans
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub Form_Load()
Loadlvw
End Sub

Private Sub Loadlvw()
Dim Sql As String
Dim rSt As New ADODB.Recordset
Dim itm As ListItem
Dim i As Integer
Dim j As Integer
Sql = "select distinct IP,SubSysID,AccountID from tSYS_MutexObjectStatus " & _
    " Union all " & _
    "  select distinct IP,SubSysID,AccountID from tSYS_MutexStatus"
rSt.Open Sql, gloSys.cnnSys, adOpenKeyset, adLockPessimistic
While Not rSt.EOF
    Set itm = lVw.ListItems.Add
    itm.Key = "k" + CStr(lVw.ListItems.Count)
    itm.text = rSt.Fields("IP").Value
    itm.SubItems(1) = rSt.Fields("SubSysID").Value
    itm.SubItems(2) = rSt.Fields("AccountID").Value
    rSt.MoveNext
Wend
rSt.Close
For i = 1 To lVw.ListItems.Count - 1
    Set itm = lVw.ListItems("k" + CStr(i))
    For j = i + 1 To lVw.ListItems.Count
        If itm.text = lVw.ListItems("k" + CStr(j)) _
            And itm.SubItems(1) = lVw.ListItems("k" + CStr(j)).SubItems(1) _
            And itm.SubItems(2) = lVw.ListItems("k" + CStr(j)).SubItems(2) Then
            itm.Tag = "Del"
        End If
    Next
Next
For Each itm In lVw.ListItems
    If itm.Tag = "Del" Then lVw.ListItems.Remove itm.Key
Next
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -