如何提高自己程序的优先权!?(30分)

  • 主题发起人 主题发起人 鹦鹉
  • 开始时间 开始时间

鹦鹉

Unregistered / Unconfirmed
GUEST, unregistred user!
我想使我编写的程序的进程优先权级别高一些,在使用计算机资源的时候享有优先权。
另外,把程序写入注册表key_local_machine/software/microsoft/windows/
currentversion/run和key_local_machine/software/microsoft/windows/
currentversion/run/runsevices。这两个不同的目录有什么区别!?
 
run:每次注册都会运行。
runsevices:系统启动就会运行不管你是否登录注册。
 
Call the Win32 API to do it!
 
whao to call win32 api
 
用程序管理器可以设置,但自己怎么设置部知道
 
SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS)可以得到高一点的优先级
HIGH_PRIORITY_CLASS 换成 REALTIME_PRIORITY_CLASS ,就是实时,优先级最高,
但是要注意,你设置自己的进程为实时,当你的进程很忙的时候,可能鼠标动起来都很困难
 
最好不要这样做,想提高自己程序的运行效率,不要靠高优先级,
而是自己的程序代码,如果你提高的优先级比WINDOWS里的explore还高的话,
那么如果你的程序忙或者死的时候,explore都动不了,你的机器就死定了
 
请教Pipi,那条语句应该放在哪儿[?]
 
你可以用delphi的TThread类
1 var
2 SecondProcess: TMyThread; { TMyThread is a custom descendant of TThread }
3 begin
4 SecondProcess := TMyThread.Create(True); { create suspended ?secondprocess does not run yet }
5 SecondProcess.Priority := tpHigher; { set the priority to Higher than normal }
6 SecondProcess.Resume; { now run the thread }
7 end;
第5句用来提高线程的优先级。或者调用SetPriorityClass函数。但是没有特别的需求用
相对优先级就可以了。不要将自己程序的优先级设置过高,可能会影响到系统进程。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部