Guest User

source

a guest
May 27th, 2016
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 5.57 KB | None | 0 0
  1. Imports System
  2. Imports System.IO
  3. Imports System.Net
  4. Imports System.Web
  5. Imports System.Management
  6. Imports System.Net.Dns
  7. Public Class Form1
  8.     Dim selecteditem As String = String.Empty
  9.     Dim helditem As String = String.Empty
  10.     Dim StoreIndex As Integer = 0
  11.     Dim direct As String = My.Application.Info.DirectoryPath & "/"
  12.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  13.        
  14.        'was code here, i removed it... calls to a module for update purposes
  15.         ListBox1.Items.Clear()
  16.        
  17.     End Sub
  18.     Public Sub gettasks()
  19.  
  20.         ListBox1.Items.Clear()
  21.         For Each p As Process In Process.GetProcesses
  22.             If p.ProcessName.ToString <> "Idle" Then
  23.                 ListBox1.Items.Add(p.ProcessName.ToString)
  24.             End If
  25.         Next
  26.     End Sub
  27.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  28.         Call gettasks()
  29.     End Sub
  30.  
  31.     Private Sub CheckedListBox1_SelectedIndexChanged(sender As Object, e As EventArgs)
  32.         'Dim x As String
  33.         'x = CheckedListBox1.GetItemChecked()
  34.         'MsgBox(CheckedListBox1.GetItemCheckState)
  35.     End Sub
  36.  
  37.     Private Sub CheckedListBox1_ItemCheck(sender As Object, e As ItemCheckEventArgs)
  38.  
  39.     End Sub
  40.  
  41.     Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
  42.         If CheckBox1.Checked = True Then
  43.             Timer1.Start()
  44.         Else
  45.             Timer1.Stop()
  46.         End If
  47.     End Sub
  48.  
  49.     Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
  50.         Call gettasks()
  51.  
  52.         ListBox1.SelectedIndex = StoreIndex
  53.         If ListBox1.SelectedItem <> helditem Then
  54.             'RichTextBox1.AppendText("MATCH FAILURE" & ControlChars.NewLine & "ITEM INDEX: " & ListBox1.SelectedIndex & ControlChars.NewLine & "ITEM NAME: " & ListBox1.SelectedItem & ControlChars.NewLine)
  55.             ListBox1.SelectedItem = helditem
  56.  
  57.         End If
  58.  
  59.     End Sub
  60.  
  61.     Private Sub KILLToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles KILLToolStripMenuItem.Click
  62.  
  63.         Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName(selecteditem)
  64.         Dim result As String
  65.         Try
  66.  
  67.             For Each p As Process In pProcess
  68.                 p.Kill()
  69.             Next
  70.             RichTextBox1.AppendText("PROCESS KILLED: " & selecteditem & ControlChars.NewLine)
  71.         Catch ex As Exception
  72.             result = MsgBox("THERE WAS AN ERROR STOPPING THE PROGRAM, WOULD YOU LIKE TO KNOW WHY?", MessageBoxButtons.YesNo)
  73.             If result = vbYes Then
  74.                 MsgBox(ex.ToString)
  75.             End If
  76.         End Try
  77.         Call gettasks()
  78.     End Sub
  79.  
  80.     Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
  81.         selecteditem = ListBox1.SelectedItem.ToString
  82.         ToolStripTextBox1.Text = selecteditem
  83.         StoreIndex = ListBox1.SelectedIndex
  84.     End Sub
  85.  
  86.     Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
  87.         Dim result As String
  88.         Try
  89.             Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName(helditem)
  90.             If pProcess.Count > 0 Then
  91.  
  92.                 For Each p As Process In pProcess
  93.  
  94.                     p.Kill()
  95.                 Next
  96.                 RichTextBox1.AppendText("PROCESS KILLED: " & helditem & ControlChars.NewLine)
  97.             End If
  98.  
  99.  
  100.         Catch ex As Exception
  101.             Timer2.Stop()
  102.             RichTextBox1.AppendText("FAILED TO KILL: " & helditem & ControlChars.NewLine)
  103.             result = MsgBox("THERE WAS AN ERROR STOPPING THE PROGRAM, WOULD YOU LIKE TO KNOW WHY?", MessageBoxButtons.YesNo)
  104.             If result = vbYes Then
  105.                 MsgBox("COULD NOT KILL [" & helditem & "] BECAUSE" & ControlChars.NewLine & ex.ToString)
  106.             End If
  107.         End Try
  108.     End Sub
  109.  
  110.     Private Sub HOLDToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles HOLDToolStripMenuItem1.Click
  111.         helditem = selecteditem
  112.         Timer2.Start()
  113.  
  114.     End Sub
  115.  
  116.     Private Sub PAUSEToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles PAUSEToolStripMenuItem.Click
  117.         Timer2.Stop()
  118.     End Sub
  119.  
  120.     Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
  121.         Label2.Text = "AVAILABLE MEMORY: " & System.Math.Round(My.Computer.Info.AvailablePhysicalMemory / (1024 * 1024)) & " mb"
  122.     End Sub
  123.  
  124.     Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  125.         RichTextBox1.Text = String.Empty
  126.         ListBox1.Items.Clear()
  127.  
  128.     End Sub
  129.  
  130.     Private Sub SEARCHToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles SEARCHToolStripMenuItem1.Click
  131.         Dim found As String
  132.         For i = 0 To ListBox1.Items.Count - 1
  133.             If ListBox1.Items(i) = ToolStripTextBox1.Text Then
  134.                 found = (ListBox1.Items(i).ToString)
  135.                 ListBox1.SetSelected(i, True)
  136.  
  137.             End If
  138.  
  139.         Next
  140.         RichTextBox1.AppendText("PROCESS FOUND: " & found & ControlChars.NewLine)
  141.     End Sub
  142.  
  143.     Private Sub ToolStripTextBox1_Click(sender As Object, e As EventArgs) Handles ToolStripTextBox1.Click
  144.  
  145.     End Sub
  146.  
  147.     Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDown1.ValueChanged
  148.         Timer1.Interval = NumericUpDown1.Value * 1000
  149.     End Sub
  150.  
  151.     Private Sub Button3_Click(sender As Object, e As EventArgs)
  152.         Call getversion()
  153.     End Sub
  154. End Class
Advertisement
Add Comment
Please, Sign In to add comment