home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 3_2004-2005.ISO / Data / Zips / _Firewall_1826711272004.psc / frmPriority.frm < prev    next >
Text File  |  2004-11-28  |  4KB  |  138 lines

  1. VERSION 5.00
  2. Begin VB.Form frmPriority 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Set Process Priority"
  5.    ClientHeight    =   1335
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   3555
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   1335
  13.    ScaleWidth      =   3555
  14.    StartUpPosition =   3  'Windows Default
  15.    Begin VB.CommandButton cmdCancel 
  16.       Caption         =   "Cancel"
  17.       Height          =   255
  18.       Left            =   2640
  19.       TabIndex        =   5
  20.       Top             =   960
  21.       Width           =   855
  22.    End
  23.    Begin VB.TextBox txtPriPID 
  24.       Height          =   285
  25.       Left            =   960
  26.       TabIndex        =   4
  27.       Top             =   120
  28.       Width           =   735
  29.    End
  30.    Begin VB.ComboBox cmbPriority 
  31.       Height          =   315
  32.       ItemData        =   "frmPriority.frx":0000
  33.       Left            =   960
  34.       List            =   "frmPriority.frx":0010
  35.       Style           =   2  'Dropdown List
  36.       TabIndex        =   2
  37.       Top             =   480
  38.       Width           =   1935
  39.    End
  40.    Begin VB.CommandButton cmdPriNormal 
  41.       Caption         =   "Set Default"
  42.       Height          =   255
  43.       Left            =   1680
  44.       TabIndex        =   1
  45.       Top             =   960
  46.       Width           =   975
  47.    End
  48.    Begin VB.CommandButton cmdApplyPri 
  49.       Caption         =   "Change Priority"
  50.       Height          =   255
  51.       Left            =   120
  52.       TabIndex        =   0
  53.       Top             =   960
  54.       Width           =   1575
  55.    End
  56.    Begin VB.Label Label2 
  57.       Caption         =   "Priority:"
  58.       Height          =   255
  59.       Left            =   360
  60.       TabIndex        =   6
  61.       Top             =   480
  62.       Width           =   495
  63.    End
  64.    Begin VB.Label Label1 
  65.       Caption         =   "Process ID:"
  66.       Height          =   255
  67.       Left            =   0
  68.       TabIndex        =   3
  69.       Top             =   120
  70.       Width           =   855
  71.    End
  72. End
  73. Attribute VB_Name = "frmPriority"
  74. Attribute VB_GlobalNameSpace = False
  75. Attribute VB_Creatable = False
  76. Attribute VB_PredeclaredId = True
  77. Attribute VB_Exposed = False
  78. Private Sub cmdApplyPri_Click()
  79. Dim pid As Long
  80. Dim priHwnd As Long
  81. Dim temp As MSComctlLib.ListItem
  82.     If txtPriPID.Text <> "" Or txtPriPID.Text <> 0 Then
  83.         pid = txtPriPID.Text
  84.         priHwnd = OpenProcess(PROCESS_SET_INFORMATION, False, pid)
  85.         
  86.         Select Case cmbPriority.ListIndex
  87.         
  88.         Case 0
  89.             SetPriorityClass priHwnd, REALTIME_PRIORITY_CLASS
  90.         Case 1
  91.             SetPriorityClass priHwnd, HIGH_PRIORITY_CLASS
  92.         Case 2
  93.             SetPriorityClass priHwnd, NORMAL_PRIORITY_CLASS
  94.         Case 3
  95.             SetPriorityClass priHwnd, IDLE_PRIORITY_CLASS
  96.         End Select
  97.         CloseHandle priHwnd
  98.         external = 1
  99.         checkPID = pid
  100.         Call frmProc.lstvwProc_ItemClick(temp)
  101.         external = 0
  102.         checkPID = 0
  103.         Unload frmPriority
  104.     Else
  105.         MsgBox "You must enter a valid Process ID", vbOKOnly, "Invalid Process ID"
  106.         Exit Sub
  107.     End If
  108. End Sub
  109.  
  110. Private Sub cmdCancel_Click()
  111.     Unload frmPriority
  112. End Sub
  113.  
  114. Private Sub cmdPriNormal_Click()
  115. Dim pid As Long
  116. Dim priHwnd As Long
  117. Dim temp As MSComctlLib.ListItem
  118.     If txtPriPID.Text <> "" Or txtPriPID.Text <> 0 Then
  119.         pid = txtPriPID.Text
  120.         priHwnd = OpenProcess(PROCESS_SET_INFORMATION, False, pid)
  121.         SetPriorityClass priHwnd, NORMAL_PRIORITY_CLASS
  122.         CloseHandle hWnd
  123.         external = 1
  124.         checkPID = pid
  125.         Call frmProc.lstvwProc_ItemClick(temp)
  126.         external = 0
  127.         checkPID = 0
  128.         Unload frmPriority
  129.     Else
  130.         MsgBox "You must enter a valid Process ID", vbOKOnly, "Invalid Process ID"
  131.         Exit Sub
  132.     End If
  133. End Sub
  134.  
  135. Private Sub Form_Load()
  136.     txtPriPID.Text = infoProcInfo.th32ProcessID
  137. End Sub
  138.