VB设置进程优先级
http://topic.csdn.net/t/20060401/19/4656391.html
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function SetPriorityClass Lib "kernel32" (ByVal hProcess As Long, ByVal dwPriorityClass As Long) As Long
Const IDLE_PRIORITY_CLASS = &H40 '新进程应该有非常低的优先级——只有在系统空闲的时候才能运行。基本值是4
Const HIGH_PRIORITY_CLASS = &H80 '新进程有非常高的优先级,它优先于大多数应用程序。基本值是13。注意尽量避免采用这个优先级
Const NORMAL_PRIORITY_CLASS = &H20 '标准优先级。如进程位于前台,则基本值是9;如在后台,则优先值是7
Dim CurrentProcesshWnd As Long '当前进程句柄
Private Sub Form_Load()
CurrentProcesshWnd = GetCurrentProcess
If (SetPriorityClass(CurrentProcesshWnd, HIGH_PRIORITY_CLASS) = 0) Then
MsgBox "设置当前进程优先级为高。失败!"
Else
MsgBox "设置当前进程优先级为高。成功!"
End If
End Sub
相关文档:
'代码:
Option Explicit
'======================用于查找进程和终止进程的API函数常数定义================ =====
Private Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function ProcessF ......
在工程中添加一个类模块,名为 Selection
然后加入以下代码:
Dim colRows As Collection
Dim ControlKey As Boolean
Public WithEvents flx As M ......
VB 注释程序代码的符号是 ',只要在某行程序前面加上该符号就可以注释该行程序。但如果程序代码语句很多的时候,一行一行地注释就非常不方便。其实 VB
本身提供了一次性注释多条语句的功能:在主菜单“视图”选项的“工具栏”下,选中“编辑”,VB
的界面会出现一排工具按钮,其中就有用 ......
1、Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As
Integer)
Cancel = True
End Sub
2、Private Sub
Form_Unload(Cancel As Integer)
Cancel = ......
Dim p(10000, 1) As Double
Dim num As Integer
Dim ptx As Single
Dim pty As Single
Dim w0, w1, w2, w3 As Single
Private Sub Command1_Click()
Dim t As Single
Dim i As Integer
Dim f0, f1, f2, f3 As Single
Picture1.DrawWidth = 3
For t = 0 To 1 St ......