VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmMachines 
   BackColor       =   &H00404040&
   BorderStyle     =   0  'None
   Caption         =   "Equipamentos"
   ClientHeight    =   8115
   ClientLeft      =   5880
   ClientTop       =   4545
   ClientWidth     =   7470
   BeginProperty Font 
      Name            =   "Small Fonts"
      Size            =   6.75
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   541
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   498
   ShowInTaskbar   =   0   'False
   Begin Synapsis.AutoScroll ascBar 
      Align           =   4  'Align Right
      Height          =   7665
      Left            =   4935
      TabIndex        =   3
      Top             =   255
      Width           =   2535
      _ExtentX        =   4471
      _ExtentY        =   13520
      BackColor       =   4210752
      Begin VB.PictureBox picContainer 
         BackColor       =   &H00404040&
         BorderStyle     =   0  'None
         Height          =   6435
         Left            =   0
         ScaleHeight     =   6435
         ScaleWidth      =   2535
         TabIndex        =   4
         Top             =   0
         Width           =   2535
         Begin Synapsis.MicroHeader mhdDeco 
            Height          =   255
            Index           =   3
            Left            =   0
            TabIndex        =   12
            Top             =   4455
            Width           =   2565
            _ExtentX        =   4524
            _ExtentY        =   450
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   16769216
            Caption         =   "Cadastro"
            UseIcons        =   0   'False
         End
         Begin Synapsis.MicroHeader mhdDeco 
            Height          =   255
            Index           =   2
            Left            =   0
            TabIndex        =   13
            Top             =   3375
            Width           =   2565
            _ExtentX        =   4524
            _ExtentY        =   450
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   16769216
            Caption         =   "Sistema"
            UseIcons        =   0   'False
         End
         Begin Synapsis.MicroHeader mhdDeco 
            Height          =   255
            Index           =   1
            Left            =   0
            TabIndex        =   14
            Top             =   1845
            Width           =   2565
            _ExtentX        =   4524
            _ExtentY        =   450
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   16769216
            Caption         =   "Equipamento"
            UseIcons        =   0   'False
         End
         Begin VB.CheckBox chkAll 
            Appearance      =   0  'Flat
            BackColor       =   &H00606060&
            Caption         =   "Selecionar Todos"
            BeginProperty Font 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H80000008&
            Height          =   285
            Left            =   90
            Style           =   1  'Graphical
            TabIndex        =   10
            Top             =   45
            Width           =   2355
         End
         Begin VB.ListBox lstVerbs0 
            Appearance      =   0  'Flat
            BackColor       =   &H00404040&
            BeginProperty Font 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00D0D0D0&
            Height          =   930
            Index           =   4
            IntegralHeight  =   0   'False
            ItemData        =   "frmMachines.frx":0000
            Left            =   -45
            List            =   "frmMachines.frx":0010
            TabIndex        =   9
            Top             =   5625
            Width           =   2625
         End
         Begin VB.ListBox lstVerbs0 
            Appearance      =   0  'Flat
            BackColor       =   &H00404040&
            BeginProperty Font 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00D0D0D0&
            Height          =   735
            Index           =   3
            IntegralHeight  =   0   'False
            ItemData        =   "frmMachines.frx":006C
            Left            =   -45
            List            =   "frmMachines.frx":0079
            TabIndex        =   8
            Top             =   4680
            Width           =   2625
         End
         Begin VB.ListBox lstVerbs0 
            Appearance      =   0  'Flat
            BackColor       =   &H00404040&
            BeginProperty Font 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00D0D0D0&
            Height          =   1020
            Index           =   2
            IntegralHeight  =   0   'False
            ItemData        =   "frmMachines.frx":00A9
            Left            =   -45
            List            =   "frmMachines.frx":00B9
            TabIndex        =   7
            Top             =   3600
            Width           =   2625
         End
         Begin VB.ListBox lstVerbs0 
            Appearance      =   0  'Flat
            BackColor       =   &H00404040&
            BeginProperty Font 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00D0D0D0&
            Height          =   1350
            Index           =   1
            IntegralHeight  =   0   'False
            ItemData        =   "frmMachines.frx":0121
            Left            =   -45
            List            =   "frmMachines.frx":0137
            TabIndex        =   6
            Top             =   2070
            Width           =   2625
         End
         Begin VB.ListBox lstVerbs0 
            Appearance      =   0  'Flat
            BackColor       =   &H00404040&
            BeginProperty Font 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00D0D0D0&
            Height          =   1305
            Index           =   0
            IntegralHeight  =   0   'False
            ItemData        =   "frmMachines.frx":01B9
            Left            =   -45
            List            =   "frmMachines.frx":01CF
            TabIndex        =   5
            Top             =   585
            Width           =   2625
         End
         Begin Synapsis.MicroHeader mhdDeco 
            Height          =   255
            Index           =   4
            Left            =   0
            TabIndex        =   11
            Top             =   5400
            Width           =   2565
            _ExtentX        =   4524
            _ExtentY        =   450
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   16769216
            Caption         =   "Usuário"
            UseIcons        =   0   'False
         End
         Begin Synapsis.MicroHeader mhdDeco 
            Height          =   255
            Index           =   0
            Left            =   0
            TabIndex        =   15
            Top             =   360
            Width           =   2565
            _ExtentX        =   4048
            _ExtentY        =   450
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   16769216
            Caption         =   "Neuron"
            UseIcons        =   0   'False
         End
      End
   End
   Begin Synapsis.MicroFooter mcfMain 
      Align           =   2  'Align Bottom
      Height          =   195
      Left            =   0
      TabIndex        =   1
      Top             =   7920
      Width           =   7470
      _ExtentX        =   13176
      _ExtentY        =   344
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Small Fonts"
         Size            =   6.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Caption         =   "[DEL] Exclui, [INS] Cria novo, [DoubleClick] Edita"
   End
   Begin Synapsis.MicroHeader mchMain 
      Align           =   1  'Align Top
      Height          =   255
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   7470
      _ExtentX        =   13176
      _ExtentY        =   450
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Caption         =   "Equipamentos"
   End
   Begin MSComctlLib.ListView lstItems 
      DragIcon        =   "frmMachines.frx":0233
      Height          =   6225
      Left            =   135
      TabIndex        =   2
      Tag             =   "MachineList"
      Top             =   405
      Width           =   4740
      _ExtentX        =   8361
      _ExtentY        =   10980
      View            =   3
      LabelEdit       =   1
      MultiSelect     =   -1  'True
      LabelWrap       =   -1  'True
      HideSelection   =   0   'False
      FullRowSelect   =   -1  'True
      _Version        =   393217
      Icons           =   "imlMain"
      SmallIcons      =   "imlMain"
      ForeColor       =   16777215
      BackColor       =   6316128
      Appearance      =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      NumItems        =   9
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Text            =   "Status"
         Object.Width           =   38100
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   1
         Text            =   "ID"
         Object.Width           =   38100
      EndProperty
      BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   2
         Text            =   "Nome"
         Object.Width           =   38100
      EndProperty
      BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   3
         Text            =   "Usuário"
         Object.Width           =   38100
      EndProperty
      BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   4
         Text            =   "Nome"
         Object.Width           =   38100
      EndProperty
      BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   5
         Text            =   "Início"
         Object.Width           =   38100
      EndProperty
      BeginProperty ColumnHeader(7) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   6
         Text            =   "Período"
         Object.Width           =   38100
      EndProperty
      BeginProperty ColumnHeader(8) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   7
         Text            =   "Utilizado"
         Object.Width           =   38100
      EndProperty
      BeginProperty ColumnHeader(9) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   8
         Text            =   "Restante"
         Object.Width           =   38100
      EndProperty
   End
   Begin MSComctlLib.ImageList imlMain 
      Left            =   0
      Top             =   0
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   32
      ImageHeight     =   30
      MaskColor       =   4210752
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   5
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmMachines.frx":0AFD
            Key             =   "ghost"
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmMachines.frx":130F
            Key             =   "transfer"
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmMachines.frx":1B21
            Key             =   "error"
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmMachines.frx":2333
            Key             =   "unlocked"
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmMachines.frx":2B45
            Key             =   "locked"
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "frmMachines"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub chkAll_Click()
On Error GoTo pschkAll_ClickErr 'EHCG.UID.pschkAll_Click

Dim uItem As ListItem

    For Each uItem In Me.lstItems.ListItems
    uItem.Selected = (chkAll.Value = 1)
    Next uItem

Exit Sub
pschkAll_ClickErr:
Err.Raise Err.number, Err.Source, "ps.chkAll_Click (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Private Sub Form_GotFocus()
On Error GoTo psForm_GotFocusErr 'EHCG.UID.psForm_GotFocus

Me.mchMain.Focus = True

Exit Sub
psForm_GotFocusErr:
Err.Raise Err.number, Err.Source, "ps.Form_GotFocus (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Private Sub Form_Load()
On Error GoTo psForm_LoadErr 'EHCG.UID.psForm_Load

ApplyLanguage Me

Data.MachineListLoaded = True
Me.Visible = True
Call PopulateList

Exit Sub
psForm_LoadErr:
Err.Raise Err.number, Err.Source, "ps.Form_Load (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Private Sub Form_LostFocus()
On Error GoTo psForm_LostFocusErr 'EHCG.UID.psForm_LostFocus

Me.mchMain.Focus = False

Exit Sub
psForm_LostFocusErr:
Err.Raise Err.number, Err.Source, "ps.Form_LostFocus (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Private Sub Form_Resize()
On Error GoTo psForm_ResizeErr 'EHCG.UID.psForm_Resize

    With Me.lstItems
    .Left = 0
    .Top = Me.mchMain.Height
    .Width = Me.ScaleWidth - Me.ascBar.Width
    .Height = Me.ScaleHeight - Me.mcfMain.Height - Me.mchMain.Height
    End With

Exit Sub
psForm_ResizeErr:
Err.Raise Err.number, Err.Source, "ps.Form_Resize (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Sub PopulateList()
On Error GoTo sPopulateListErr 'EHCG.UID.sPopulateList

Dim lMachine As Machine, Count As Long, uLItem As ListItem

Me.lstItems.ListItems.Clear

    For Count = 1 To Data.Machines.Count
    Set lMachine = Data.Machines.Item(Count)
    Set uLItem = Me.lstItems.ListItems.Add
    Call PopulateItem(uLItem, lMachine, True)
    Next Count

ListViewAutoSize Me.lstItems

Exit Sub
sPopulateListErr:
Err.Raise Err.number, Err.Source, "s.PopulateList (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error GoTo psForm_UnloadErr 'EHCG.UID.psForm_Unload

Data.MachineListLoaded = False

Exit Sub
psForm_UnloadErr:
Err.Raise Err.number, Err.Source, "ps.Form_Unload (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Private Sub lstItems_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
On Error GoTo pslstItems_ColumnClickErr 'EHCG.UID.pslstItems_ColumnClick

Call ListItemOrderByColumn(lstItems, ColumnHeader)

Exit Sub
pslstItems_ColumnClickErr:
Err.Raise Err.number, Err.Source, "ps.lstItems_ColumnClick (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Sub PopulateItem(ByRef uItem As ListItem, lMachine As Machine, Optional DontUpdate As Boolean = False)
On Error GoTo sPopulateItemErr 'EHCG.UID.sPopulateItem

Dim uMS As Machine_Status, uU As User, uColored As Boolean

uItem.Tag = lMachine.Macaddress
uItem.SmallIcon = lMachine.Status + 1
uItem.Text = MachineStatusText(lMachine.Status)
uItem.SubItems(1) = lMachine.Sign
uItem.SubItems(2) = lMachine.Netname
Dim uSecondsPassed As Long
'uId = Replace(uId, uItem.Tag, "")

Set uMS = Data.Machine_Statuses.SeekMachine(lMachine)

    If TypeName(uMS) <> "Nothing" Then

        If TypeName(uMS.User) <> "Nothing" Then
        Set uU = uMS.User
        uItem.SubItems(3) = uU.Alias
        uItem.SubItems(4) = uU.Name
        uItem.SubItems(5) = Format$(uMS.user_initTime, "HH:NN")
            uSecondsPassed = Abs(DateDiff("n", Now(), CDate(uMS.user_initTime)))
        uItem.SubItems(7) = Int(uSecondsPassed / 60) & ":" & Right$("0" & (uSecondsPassed Mod 60), 2)

            If Year(uMS.user_endTime) <> 1899 Then
            uSecondsPassed = Abs(DateDiff("n", CDate(uMS.user_endTime), CDate(uMS.user_initTime)))
            uItem.SubItems(6) = Int(uSecondsPassed / 60) & ":" & Right$("0" & (uSecondsPassed Mod 60), 2)
            uSecondsPassed = Abs(DateDiff("n", CDate(uMS.user_endTime), CDate(Now)))
            uItem.SubItems(8) = IIf(CDate(uMS.user_endTime) <= Now(), "+", "") & Int(uSecondsPassed / 60) & ":" & Right$("0" & (uSecondsPassed Mod 60), 2)

                If CDate(uMS.user_endTime) <= Now() Then
                uColored = True
                End If

            End If

        Else
        uItem.SubItems(3) = ""
        uItem.SubItems(4) = ""
        uItem.SubItems(5) = ""
        uItem.SubItems(6) = ""
        uItem.SubItems(7) = ""
        uItem.SubItems(8) = ""

        End If

    End If


    If Not uColored Then

        If uItem.ForeColor <> &HFFFFFF Then
        uItem.ForeColor = &HFFFFFF
        uItem.ListSubItems(1).ForeColor = &HFFFFFF
        uItem.ListSubItems(2).ForeColor = &HFFFFFF
        uItem.ListSubItems(3).ForeColor = &HFFFFFF
        uItem.ListSubItems(3).ForeColor = &HFFFFFF
        uItem.ListSubItems(4).ForeColor = &HFFFFFF
        uItem.ListSubItems(5).ForeColor = &HFFFFFF
        uItem.ListSubItems(6).ForeColor = &HFFFFFF
        uItem.ListSubItems(7).ForeColor = &HFFFFFF
        uItem.ListSubItems(8).ForeColor = &HFFFFFF
        End If

    Else

        If uItem.ForeColor <> &H40FFFF Then
        uItem.ForeColor = &H40FFFF
        uItem.ListSubItems(1).ForeColor = &H40FFFF
        uItem.ListSubItems(2).ForeColor = &H40FFFF
        uItem.ListSubItems(3).ForeColor = &H40FFFF
        uItem.ListSubItems(3).ForeColor = &H40FFFF
        uItem.ListSubItems(4).ForeColor = &H40FFFF
        uItem.ListSubItems(5).ForeColor = &H40FFFF
        uItem.ListSubItems(6).ForeColor = &H40FFFF
        uItem.ListSubItems(7).ForeColor = &H40FFFF
        uItem.ListSubItems(8).ForeColor = &H40FFFF
        End If

    End If

    If Not DontUpdate Then ListViewAutoSize Me.lstItems

Exit Sub
sPopulateItemErr:
Err.Raise Err.number, Err.Source, "s.PopulateItem (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Sub UpdateItem(ByVal uId As String)
On Error GoTo sUpdateItemErr 'EHCG.UID.sUpdateItem

Dim uItem As ListItem, lMachine As Machine, uFound As Boolean, Count As Long
Dim uList1 As String, uList2 As String, uCreated As Boolean, uRemoved As Boolean

restart:

    If uId = "" Then Exit Sub


    For Each uItem In Me.lstItems.ListItems
    uRemoved = False

        If InStr(uId, uItem.Tag) <> 0 Then
        Set lMachine = Data.Machines.Item(uItem.Tag)

            If TypeName(lMachine) = "Nothing" Then 'Excluido.
            uId = Replace(uId, uItem.Tag, "")
            Me.lstItems.ListItems.Remove (uItem.Index)
            uRemoved = True

            GoTo restart

            Else
            uId = Replace(uId, uItem.Tag, "")
            PopulateItem uItem, lMachine

            End If

        End If

    Next uItem

uList1 = uId

    Do
    uList2 = Replace(uList1, "||", "|")

        If uList2 = uList1 Then Exit Do

    uList1 = uList2

    Loop


    If Left$(uList1, 1) = "|" Then uList1 = Right$(uList1, Len(uList1) - 1)
    If Right$(uList1, 1) = "|" Then uList1 = Left$(uList1, Len(uList1) - 1)


    If uList1 <> "" Then 'Ainda existem itens: Provavelmente, novas adições. Vamos, então, criá-los.
    uCreated = False

    Count = 0

        Do
        uList2 = ParseDataBlock(uList1, Count, "|")

            If uList2 = "" Then Exit Do

        Set uItem = Me.lstItems.ListItems.Add
        uCreated = True
        uItem.Tag = uList2

        Count = Count + 1

        Loop


        If uCreated Then GoTo restart

    End If

Exit Sub
sUpdateItemErr:
Err.Raise Err.number, Err.Source, "s.UpdateItem (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Private Sub lstItems_DragDrop(Source As Control, x As Single, y As Single)
On Error GoTo pslstItems_DragDropErr 'EHCG.UID.pslstItems_DragDrop

Dim uOrigin As String, uLocalTag As String, uRemoteTag As String, uOriginStatus As Machine_Status, uRemoteStatus As Machine_Status

    If TypeName(Me.lstItems.HitTest(x, y)) = "Nothing" Then Exit Sub

uOrigin = Source.Tag
uRemoteTag = ListViewGetSelectedList(Source)
uLocalTag = Me.lstItems.HitTest(x, y).Tag

    Select Case uOrigin
    Case "MachineList" 'Mm... Uma transferencia de usuario, talvez. Vamos ver.

        If uRemoteTag = uLocalTag Then Exit Sub 'Normal.

        CheckMachineStatusReg Data.Machines.Item(uLocalTag)
        CheckMachineStatusReg Data.Machines.Item(uRemoteTag)

        If TypeName(Data.Machine_Statuses.SeekMachine(Data.Machines.Item(uLocalTag)).User) <> "Nothing" Then 'Alguém na máquina Destino. não é necessário fazer nada.
        Exit Sub
        End If

        If TypeName(Data.Machine_Statuses.SeekMachine(Data.Machines.Item(uRemoteTag)).User) = "Nothing" Then 'Ninguém na máquina origem. não é necessário fazer nada.
        Exit Sub
        End If

    Set uOriginStatus = Data.Machine_Statuses.SeekMachine(Data.Machines.Item(uLocalTag))
    Set uRemoteStatus = Data.Machine_Statuses.SeekMachine(Data.Machines.Item(uRemoteTag))

    Set uOriginStatus.User = uRemoteStatus.User
    uOriginStatus.user_endTime = uRemoteStatus.user_endTime
    uOriginStatus.user_initTime = uRemoteStatus.user_initTime
    uOriginStatus.NextTokenCheck = uRemoteStatus.NextTokenCheck
    Set uRemoteStatus.User = Nothing
    UpdateItem uLocalTag
    UpdateItem uRemoteTag

    Case "MicroUserList", "UserQueue", "MainUserList"

        If TypeName(Data.Users.SeekID(CLng(uRemoteTag))) = "Nothing" Then
        Exit Sub
        End If
        Dim uUser As User
        Set uUser = Data.Users.SeekID(CLng(uRemoteTag))

        If TypeName(Data.Machine_Statuses.SeekUser(uUser)) <> "Nothing" Then   'Esta pessoa esta em alguma outra maquina. Pular fora.
        Exit Sub
        End If

    Set uRemoteStatus = Data.Machine_Statuses.SeekMachine(Data.Machines.Item(uLocalTag))

        If TypeName(uRemoteStatus) <> "Nothing" Then 'Tem alguem. Pular fora.

            If TypeName(uRemoteStatus.User) <> "Nothing" Then 'Tem alguem. Pular fora.
            Exit Sub
            End If

        End If

    Set uRemoteStatus = Data.Machine_Statuses.SeekMachine(Data.Machines.Item(uLocalTag))
    Set uRemoteStatus.User = uUser
    uRemoteStatus.user_initTime = Now
    Dim uTime As String, uDummyTime As Date
    uTime = InputBox("Quanto tempo este jogador deseja? Digite no formato HH:MM (Por exemplo, 01:00 para Uma Hora.)" & vbCrLf & vbCrLf & "(Aperte Enter se ele vai deixar em aberto.)")

        If IsDate(uTime) Then uRemoteStatus.user_endTime = Now + CDate(uTime) Else uRemoteStatus.user_endTime = uDummyTime

    UpdateItem uLocalTag
    RemoveUserFromQueue uUser.ID, True
    End Select

Exit Sub
pslstItems_DragDropErr:
Err.Raise Err.number, Err.Source, "ps.lstItems_DragDrop (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Private Sub lstItems_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo pslstItems_KeyDownErr 'EHCG.UID.pslstItems_KeyDown

    Select Case KeyCode
    Case 46 'exclusão.
    Call DeleteSelected

    End Select

Exit Sub
pslstItems_KeyDownErr:
Err.Raise Err.number, Err.Source, "ps.lstItems_KeyDown (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Sub DeleteSelected()
On Error GoTo sDeleteSelectedErr 'EHCG.UID.sDeleteSelected

Dim uList As String, uItem As String, uCounter As Long

uList = ListViewGetSelectedList(Me.lstItems)

If uList = "" Then Exit Sub

    Do
    uItem = ParseDataBlock(uList, uCounter, "|")

        If uItem = "" Then Exit Do

    Data.Machines.Remove uItem
    uCounter = uCounter + 1
    Loop

UpdateItem uList

ShowCaption "Equipamentos " & uList & " foram excluídos."

Exit Sub
sDeleteSelectedErr:
Err.Raise Err.number, Err.Source, "s.DeleteSelected (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Private Sub lstItems_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error GoTo pslstItems_MouseDownErr 'EHCG.UID.pslstItems_MouseDown

Me.chkAll.Value = 0

    If TypeName(lstItems.HitTest(x, y)) <> "Nothing" Then
    DragList Me.lstItems, x, y
    End If

Exit Sub
pslstItems_MouseDownErr:
Err.Raise Err.number, Err.Source, "ps.lstItems_MouseDown (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Private Sub lstVerbs0_Click(Index As Integer)
On Error GoTo pslstVerbs0_ClickErr 'EHCG.UID.pslstVerbs0_Click

Dim Counter As Long, uItem As Long, ID As String, uItemChoosed As Boolean, uTemp As String

    For Counter = 0 To Me.lstVerbs0(Index).ListCount - 1

        If Me.lstVerbs0(Index).Selected(Counter) Then
        Me.lstVerbs0(Index).Selected(Counter) = False
        uItemChoosed = True
        uItem = Counter
        Counter = Me.lstVerbs0(Index).ListCount - 1
        End If

    Next Counter

ID = Index & "." & uItem

    If Not uItemChoosed Then Exit Sub

Call ExecMenuClick(ID)

Exit Sub
pslstVerbs0_ClickErr:
Err.Raise Err.number, Err.Source, "ps.lstVerbs0_Click (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Sub ExecMenuClick(ByVal ID As String)
Dim lStrTemp As String
    
    Select Case ID

    Case "0.0" 'Neuron.Travar
    GenericSend "LOCK"


    Case "0.1" 'Neuron.Destravar
    GenericSend "UNLOCK"

    Case "0.2" 'Neuron.Identificar
    GenericSend "UNLOCK"
    GenericSend "QUERYID"

    Case "0.3" 'Neuron.Desligar
    GenericSend "SHUTDOWN"

    Case "0.4" 'Atualizar
    Call UpdateNeurons

    Case "0.5" 'Ping
    GenericSend "PING?"

    Case "1.0" 'Sistema.Ajustar Data/Hora
    GenericSend "SETTIME|" & Time
    GenericSend "SETDATE|" & Date

    Case "1.1" 'Sistema.Turn Off
    GenericSend "TURNOFF"

    Case "1.2" 'Sistema.Reboot
    GenericSend "SHUTANDLOAD"

    Case "1.3" 'Sistema.LogOff
    GenericSend "LOGOFF"

    Case "1.4" 'Sistema.Ajustar Resolucao
    GenericSend "SETRESOLUTION|1280|1024|32"

    Case "1.5" 'Sistema.COnfigurações Padrão
    PreConfigMachines

    Case "2.0" 'Purgar Spywares

    GenericSend "SAY|Purgando spáiuéres"

    lStrTemp = lStrTemp & "SAY|Matando processos." & vbCrLf & _
            "KILLPROCESS|Purity" & vbCrLf & _
            "KILLPROCESS|hotvideo" & vbCrLf & _
            "KILLPROCESS|datemaker" & vbCrLf & _
            "KILLPROCESS|ICQlite.exe" & vbCrLf & _
            "KILLPROCESS|PRECISIONTIME" & vbCrLf & _
            "KILLPROCESS|MSMSG" & vbCrLf & _
            "KILLPROCESS|MEDIAMAN" & vbCrLf & _
            "KILLPROCESS|STND" & vbCrLf & _
            "KILLPROCESS|IMESH" & vbCrLf & _
            "KILLPROCESS|RAMSYS" & vbCrLf & _
            "KILLPROCESS|109059" & vbCrLf & _
            "KILLPROCESS|VIDEOPORNO" & vbCrLf & _
            "KILLPROCESS|WINSERVN" & vbCrLf & _
            "KILLPROCESS|CMESYS" & vbCrLf & _
            "KILLPROCESS|QTTASK" & vbCrLf & _
            "KILLPROCESS|GMT" & vbCrLf

    GenericSend lStrTemp

    lStrTemp = "KILLFILE|C:\Program Files\webdialers\od-stnd67.exe" & vbCrLf & _
            "KILLFILE|C:\Program Files\dialers\ce.exe" & vbCrLf & _
            "KILLFILE|C:\Program Files\dialers\stmtdlr.exe" & vbCrLf & _
            "KILLFILE|C:\Program Files\dialers\hotvideo_br\hotvideo_br.exe" & vbCrLf & _
            "KILLFILE|C:\Windows\System32\winservn.exe" & vbCrLf & _
            "KILLFILE|C:\Arquivos de Programas\Messenger\msmsgs.exe" & vbCrLf & _
            "KILLFILE|C:\Arquivos de programas\FirstLook\FirstLook.exe" & vbCrLf & _
            "KILLDIR|C:\Program Files\dialers" & vbCrLf & _
            "KILLDIR|C:\Arquivos de Programas\PurityScan" & vbCrLf

    GenericSend lStrTemp

    lStrTemp = "DELREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\media_manager" & vbCrLf & _
            "DELREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\MSMSGS" & vbCrLf & _
            "DELREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\od-stnd67" & vbCrLf & _
            "DELREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\run"

    GenericSend lStrTemp


    Case "2.3" 'Ferramentas.Voz
    GenericSend "SAY|Bem vindo a Intuícham."

    Case "4.0" 'Retirar Usuário
    KickUsers

    Case "4.1" 'Adicionar tempo
    Addtime

    End Select

End Sub
Sub GenericSend(ByVal uParm As String)
On Error GoTo sGenericSendErr 'EHCG.UID.sGenericSend

Dim uList As String, uCounter As Long, uItem As String

    If chkAll.Value = 1 Then
    SendBroadcast uParm

    Else
    uList = ListViewGetSelectedList(Me.lstItems)

        If uList = "" Then Exit Sub

        Do
        uItem = ParseDataBlock(uList, uCounter, "|")

            If uItem = "" Then Exit Do

        Send GetIP(uItem), uParm
        uCounter = uCounter + 1
        Loop

    End If

Exit Sub
sGenericSendErr:
Err.Raise Err.number, Err.Source, "s.GenericSend (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Sub UpdateNeurons()
On Error GoTo sUpdateNeuronsErr 'EHCG.UID.sUpdateNeurons

Dim uList As String, uCounter As Long, uItem As String

uList = ListViewGetSelectedList(Me.lstItems)

    If uList = "" Then Exit Sub

    Do
    uItem = ParseDataBlock(uList, uCounter, "|")

        If uItem = "" Then Exit Do

        If Data.Machines.Item(uItem).Status <> MSDisconnected Then
        UpdateNeuron GetIP(uItem)

        End If

    uCounter = uCounter + 1
    Loop

Exit Sub
sUpdateNeuronsErr:
Err.Raise Err.number, Err.Source, "s.UpdateNeurons (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Sub UpdateNeuron(ByVal IP As String)
On Error GoTo sUpdateNeuronErr 'EHCG.UID.sUpdateNeuron

        MDIMain.ccpServer.TransferFile ".\Resources\neuron.exe", "C:\Arquivos de Programas\Neuron", IP, 65536, "temp.exe"
        Send IP, "SHELL|C:\Arquivos de Programas\Neuron\temp.exe -update"
        Send IP, "SHUTDOWN"

Exit Sub
sUpdateNeuronErr:
Err.Raise Err.number, Err.Source, "s.UpdateNeuron (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Sub KickUsers()
On Error GoTo sKickUsersErr 'EHCG.UID.sKickUsers

Dim uList As String, uCounter As Long, uItem As String, uMS As Machine_Status


uList = ListViewGetSelectedList(Me.lstItems)

    If uList = "" Then Exit Sub

    Do
    uItem = ParseDataBlock(uList, uCounter, "|")

        If uItem = "" Then Exit Do

    KickUser uItem
    uCounter = uCounter + 1
    Loop

Exit Sub
sKickUsersErr:
Err.Raise Err.number, Err.Source, "s.KickUsers (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Sub PreConfigMachines()
On Error GoTo sPreConfigMachinesErr 'EHCG.UID.sPreConfigMachines

Dim uList As String, uCounter As Long, uItem As String, uMS As Machine_Status

uList = ListViewGetSelectedList(Me.lstItems)

    If uList = "" Then Exit Sub

    Do
    uItem = ParseDataBlock(uList, uCounter, "|")

        If uItem = "" Then Exit Do


        If Data.Machines.Item(uItem).Status <> MSDisconnected Then
        Dim uCommand As String
        uCommand = _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\SecurityEnforce|C:\Arquivos de programas\Neuron\Neuron.exe" & vbCrLf & _
        "SETREGKEY|HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SecurityEnforce|C:\Arquivos de programas\Neuron\Neuron.exe" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Desktop\CursorBlinkRate|200" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Desktop\DragFullWindows|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Desktop\FontSmoothing|2" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Desktop\FontSmoothingType|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Desktop\ScreenSaveActive|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Desktop\WheelScrollLines|1" & vbCrLf

        uCommand = uCommand & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\FontSmoothing\DefaultValue|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\FontSmoothing\DefaultApplied|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ComboBoxAnimation\DefaultApplied|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\MenuAnimation\DefaultValue|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\MenuAnimation\DefaultApplied|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ListBoxSmoothScrolling\DefaultApplied|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ListviewAlphaSelect\DefaultValue|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ListviewAlphaSelect\DefaultApplied|1" & vbCrLf

        uCommand = uCommand & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\DontPrettyPath|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowInfoTip|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\WebView|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ListviewAlphaSelect|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ListviewShadow|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ListviewWatermark|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarAnimations|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\DisableThumbnailCache|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\NoNetCrawling|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\PersistBrowsers|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\FriendlyTree|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowNetPlaces|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_LargeMFUIcons|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowHelp|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_EnableDragDrop|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowRun|1" & vbCrLf

        uCommand = uCommand & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowPrinters|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\StartMenuFavorites|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowMyComputer|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowMyDocs|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowMyPics|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowMyMusic|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowControlPanel|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowSearch|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ScrollPrograms|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowRecentDocs|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_AutoCascade|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_NotifyNewApps|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_AdminToolsRoot|2" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\StartMenuAdminTools|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarSizeMove|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarGlomming|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\EnableBalloonTips|0"

        uCommand = uCommand & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\NoUpdateCheck|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\NoJITSetup|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Disable Script Debugger|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Show_ChannelBand|NO" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Anchor Underline|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Cache_Update_Frequency|Once_Per_Session" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Display Inline Images|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Do404Search|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Local Page|C:\WINDOWS\System32\blank.htm" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Save_Session_History_On_Exit|NO" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Show_FullURL|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Show_StatusBar|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Show_ToolBar|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Show_URLinStatusBar|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Show_URLToolBar|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Start Page|http:/www.intuitionitd.com/" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Use_DlgBox_Colors|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Search Page|http:/www.google.com" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Check_Associations|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FullScreen|NO" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\ShowGoButton|NO" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Error Dlg Displayed On Every Error|NO" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Error Dlg Details Pane Open|NO" & vbCrLf

        uCommand = uCommand & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\NotifyDownloadComplete|NO" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\AddToFavoritesExpanded|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Move System Caret|no" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Expand Alt Text|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Print_Background|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Enable_MyPics_Hoverbar|no" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Enable AutoImageResize|no" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Show image placeholders|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Play_Animations|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Display Inline Videos|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Play_Background_Sounds|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\UseThemes|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Enable Browser Extensions|yes" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\NoWebJITSetup|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FavIntelliMenus|NO" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Page_Transitions|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\NscSingleExpand|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Force Offscreen Composition|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Friendly http errors|no" & vbCrLf

        uCommand = uCommand & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\AllowWindowReuse|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\SmoothScroll|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\AutoSearch|5" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Use FormSuggest|no" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Save Directory|C:\" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Search Bar|http:/www.google.com/ie" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Download\CheckExeSignatures|yes" & vbCrLf

        uCommand = uCommand & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Mouse\ActiveWindowTracking|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Mouse\DoubleClickHeight|4" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Mouse\DoubleClickSpeed|500" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Mouse\DoubleClickWidth|4" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Mouse\MouseSensitivity|10" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Mouse\MouseSpeed|1" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Mouse\MouseThreshold1|6" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Mouse\MouseThreshold2|10" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Mouse\SnapToDefaultButton|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Mouse\SwapMouseButtons|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Mouse\MouseTrails|0" & vbCrLf & _
        "SETREGKEY|HKEY_CURRENT_USER\Control Panel\Mouse\MouseHoverTime|400"

        Send GetIP(uItem), uCommand
        Send GetIP(uItem), "SHUTANDLOAD"
        End If


    uCounter = uCounter + 1
    Loop

Exit Sub
sPreConfigMachinesErr:
Err.Raise Err.number, Err.Source, "s.PreConfigMachines (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
Sub Addtime()
On Error GoTo sAddtimeErr 'EHCG.UID.sAddtime

Dim uList As String, uCounter As Long, uItem As String, uPeriod As String
Dim uOpNeg As Boolean, uOldTime As Date

uPeriod = InputBox("Quanto tempo deseja adicionar? (formato HH:MM)" & vbCrLf & vbCrLf & "Inclua um sinal de menos (-) caso deseje retirar tempo deste usuário, como em -01:00 para retirar uma hora.")

    If uPeriod = "" Then
    Exit Sub
    End If

uPeriod = Trim(uPeriod)

    If Left$(uPeriod, 1) = "-" Then
    uOpNeg = True
    uPeriod = Right$(uPeriod, Len(uPeriod) - 1)
    uPeriod = Trim(uPeriod)
    End If

If Not IsDate(uPeriod) Then Exit Sub

uList = ListViewGetSelectedList(Me.lstItems)

    If uList = "" Then Exit Sub

    Do
    uItem = ParseDataBlock(uList, uCounter, "|")

        If uItem = "" Then Exit Do

    uOldTime = Data.Machine_Statuses.SeekMachine(Data.Machines.Item(uItem)).user_endTime

        If Year(uOldTime) = 1899 Then uOldTime = Now()

    Data.Machine_Statuses.SeekMachine(Data.Machines.Item(uItem)).user_endTime = IIf(uOpNeg, (DateAdd("N", Minute(CDate(uPeriod)) * -1, DateAdd("H", Hour(CDate(uPeriod)) * -1, uOldTime))), (uOldTime + CDate(uPeriod)))
    frmMachines.UpdateItem uItem
    uCounter = uCounter + 1
    Loop

Exit Sub
sAddtimeErr:
Err.Raise Err.number, Err.Source, "s.Addtime (" & Err.number & ": " & Err.Description & ")", Err.HelpFile, Err.HelpContext

End Sub
