Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Msconf87 - Form1.frm

Form1.frm

Caricato da: Natamas
Scarica il programma completo

  1. Option Explicit
  2. Dim lIndice As Long, lIndice2 As Long, cod As Long
  3. Dim sNome As String, sNome2 As String
  4. Dim sValore As String, sValore2 As String
  5. Dim lTipo As Long, lTipo2 As Long
  6. Dim percorso As String, nuovachiave As String
  7. Dim kIndice As Long
  8.  
  9. Private Sub avv_Click()
  10. Call avvio
  11. End Sub
  12.  
  13. Private Sub deletems_Click()
  14. Call ApriChiave(percorso, cod, &HF003F)
  15. Call CancellaValore(cod, "MSConfig")
  16. Call ChiudiChiave(cod)
  17. Timer1.Enabled = True
  18. End Sub
  19.  
  20. Private Sub esci_Click()
  21. Unload frmAbout
  22. Unload Form2
  23. Unload Me
  24. End Sub
  25.  
  26. Private Sub Form_Load()
  27. Me.Caption = App.Title & " vers. " & App.Major & "." & App.Minor & "." & App.Revision & "  -  By Natamas"
  28. kIndice = 1
  29. nuovachiave = "HKEY_LOCAL_MACHINE\SOFTWARE\XControl"
  30. percorso = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
  31. Call CreaChiave(nuovachiave)
  32. Call leggi
  33. Call leggi2
  34. End Sub
  35. Sub leggi()
  36. On Error GoTo errori
  37. lIndice = 0
  38. Do While EnumeraValori(percorso, lIndice, sNome, lTipo)
  39. Call LeggiChiaveStringa(percorso, sNome, sValore)
  40.  If sNome = "MSConfig" Then
  41.  deletems.Enabled = True
  42.  End If
  43.     Dim itmX As ListItem
  44.     Set itmX = listaw.ListItems.Add
  45.     itmX.Text = sNome
  46.     itmX.SubItems(1) = sValore
  47.     itmX.SubItems(2) = percorso
  48.     itmX.Checked = True
  49.     itmX.Tag = lIndice
  50.     itmX.ToolTipText = " Abilitato "
  51.     lIndice = lIndice + 1
  52. Loop
  53. errori:
  54. If Err.Number > 0 Then
  55. Call errore(Err.Description, Err.Number)
  56. Exit Sub
  57. End If
  58. End Sub
  59. Sub leggi2()
  60. On Error GoTo errori
  61. lIndice2 = 0
  62. Do While EnumeraValori(nuovachiave, lIndice2, sNome2, lTipo2)
  63. Call LeggiChiaveStringa(nuovachiave, sNome2, sValore2)
  64.     Dim itmX2 As ListItem
  65.     Set itmX2 = listaw.ListItems.Add
  66.     itmX2.Text = sNome2
  67.     itmX2.SubItems(1) = sValore2
  68.     itmX2.SubItems(2) = percorso
  69.     itmX2.Checked = False
  70.     itmX2.Tag = lIndice2
  71.     itmX2.ToolTipText = " Bloccato "
  72.     lIndice2 = lIndice2 + 1
  73. Loop
  74. errori:
  75. If Err.Number > 0 Then
  76. Call errore(Err.Description, Err.Number)
  77. Exit Sub
  78. End If
  79. End Sub
  80.  
  81. Private Sub Form_Unload(Cancel As Integer)
  82. Unload Me
  83. End Sub
  84.  
  85. Private Sub inf_Click()
  86. frmAbout.Show 1
  87. End Sub
  88.  
  89. Sub ok(Optional ByVal mess As String)
  90. If mess <> "" Then
  91. Form2.Label1.Caption = mess
  92. Form2.Frame1.Caption = ""
  93. Form2.ok.Visible = False
  94. Form2.Timer1.Enabled = True
  95. End If
  96. Form2.Visible = True
  97. Form1.Visible = False
  98. Unload Me
  99. End Sub
  100.  
  101. Private Sub listaw_ItemClick(ByVal Item As MSComctlLib.ListItem)
  102. If Not Item.Checked Then
  103. Item.Checked = True
  104. Else
  105. Item.Checked = False
  106. End If
  107. End Sub
  108.  
  109. Private Sub rel_Click()
  110. Call ok("Aggiornamento in corso, attendere .....")
  111. End Sub
  112.  
  113. Sub avvio()
  114. On Error GoTo errori
  115. Dim filesel As String, filesel2 As String, file As Long
  116. file = listaw.ListItems.Count
  117. If kIndice <= file Then
  118. filesel = listaw.ListItems.Item(kIndice)
  119. filesel2 = listaw.ListItems.Item(kIndice).SubItems(1)
  120. If (listaw.ListItems.Item(kIndice).Checked) Then
  121. Call ScriviChiaveStringa(percorso, filesel, filesel2)
  122. Call controllo(nuovachiave, filesel)
  123. Else
  124. Call ScriviChiaveStringa(nuovachiave, filesel, filesel2)
  125. Call controllo(percorso, filesel)
  126. End If
  127. Timer1.Enabled = True
  128. kIndice = kIndice + 1
  129. Call avvio
  130. End If
  131. errori:
  132. If Err.Number > 0 Then
  133. Call errore(Err.Description, Err.Number)
  134. Exit Sub
  135. End If
  136. End Sub
  137.  
  138. Sub controllo(ByVal dir As String, ByVal name As String)
  139. On Error GoTo errori
  140. Dim zIndice As Long, zTipo As Long, zNome As String, zValore As String
  141. zIndice = 0
  142. Do While EnumeraValori(dir, zIndice, zNome, zTipo)
  143. Call LeggiChiaveStringa(dir, zNome, zValore)
  144.  If zNome = name Then
  145.  Call ApriChiave(dir, cod, &HF003F)
  146.  Call CancellaValore(cod, name)
  147.  Call ChiudiChiave(cod)
  148.  End If
  149. zIndice = zIndice + 1
  150. Loop
  151. errori:
  152. If Err.Number > 0 Then
  153. Call errore(Err.Description, Err.Number)
  154. Exit Sub
  155. End If
  156. End Sub
  157.  
  158. Private Sub Timer1_Timer()
  159. Call ok
  160. Timer1.Enabled = False
  161. End Sub
  162.  
  163. Sub errore(ByVal descrizione As String, ByVal numero As Long)
  164. MsgBox ("Si e vericato questo errore: " & descrizione), vbCritical, App.Title & "  -  Errore n° " & numero
  165. Exit Sub
  166. End Sub