Advertisement
Guest User

Untitled

a guest
Jun 27th, 2011
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.38 KB | None | 0 0
  1. Imports System
  2. Imports System.Diagnostics
  3. Imports System.ComponentModel
  4.  
  5. Public Class mainForm
  6.  
  7. #Region " VARIABLES "
  8.     Public PID As Integer
  9.     Public Proc_PID As Process()
  10.     Public fproc As Process
  11. #End Region
  12.  
  13.     Private Sub NFI_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NFI.MouseDoubleClick
  14.         Me.Visible = True
  15.         Me.WindowState = FormWindowState.Normal
  16.     End Sub
  17.  
  18.     Private Sub mainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  19.         GetPid()
  20.     End Sub
  21.  
  22.     Sub GetPid()
  23.         Dim index As Integer = 0
  24.  
  25.         Proc_PID = Process.GetProcesses()
  26.  
  27.         For Each Process In Proc_PID
  28.             PIDSelect.Items.Add(Proc_PID(index).Id & " - " & Proc_PID(index).MainWindowTitle)
  29.             index += 1
  30.         Next
  31.  
  32.         PIDSelect.SelectedIndex = 0
  33.     End Sub
  34.  
  35.     Sub SetPID()
  36.         PID = Proc_PID(PIDSelect.SelectedIndex).Id
  37.         fproc = Process.GetProcessById(PID)
  38.     End Sub
  39.  
  40.     Private Sub mainForm_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
  41.         NFI.Visible = False
  42.     End Sub
  43.  
  44.     Private Sub mainForm_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
  45.         If Me.WindowState = FormWindowState.Minimized Then
  46.             Me.Visible = False
  47.             Me.ShowInTaskbar = False
  48.             NFI.Visible = True
  49.         End If
  50.         If Me.WindowState = FormWindowState.Normal Then
  51.             NFI.Visible = False
  52.             Me.ShowInTaskbar = True
  53.         End If
  54.     End Sub
  55.  
  56.     Private Sub startP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startP.Click
  57.         startP.Enabled = False
  58.         stopP.Enabled = True
  59.  
  60.         sysTimer.Interval = Int32.Parse(sysTime.Text) * 1000
  61.         sysTimer.Start()
  62.     End Sub
  63.  
  64.     Private Sub stopP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles stopP.Click
  65.         startP.Enabled = True
  66.         stopP.Enabled = False
  67.  
  68.         sysTimer.Stop()
  69.     End Sub
  70.  
  71.     Private Sub sysTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sysTimer.Tick
  72.         SetPID()
  73.         Process.GetProcessById(PID).PriorityClass = ProcessPriorityClass.AboveNormal
  74.     End Sub
  75. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement