| View previous topic :: View next topic |
| Author |
Message |
GregLand Valued Contributor


Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Thu Sep 08, 2005 2:19 am Post subject: Set priority to an active application |
|
|
Hello everybody...
I would like to know if it was possible to change the priority of a running program... (With an API I suppose...)
Can you help me ?
Thanks a lot and bye bye !
PS : I found that : http://docvb.free.fr/apidetail.php?idapi=183 But I don't know how to transform it...
Last edited by GregLand on Mon Oct 17, 2005 6:23 pm; edited 1 time in total |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Sep 08, 2005 3:37 am Post subject: |
|
|
Try this out, if ran from the VDS IDE it will change the IDE's priority.
If compiled it will change your program's priority.
| Code: |
%%pIdle = $0040
%%pBelowNormal = $004000
%%pNormal = $0020
%%pAboveNormal = $008000
%%pHigh = $0080
%%pRealtime = $00100
LOADLIB kernel32.dll
%%currProcess = @LIB(kernel32,GetCurrentProcess,INT:,NIL:)
%%ret = @LIB(kernel32,SetPriorityClass,INT:,%%currProcess,%%pAboveNormal)
if @UNEQUAL(%%ret,0)
info Priority Changed
else
info Priority Change Failed
end
%%ret = @LIB(kernel32,GetPriorityClass,INT:,%%currProcess)
if @EQUAL(@HEX(%%ret),0040)
info Current Priority is Low
end
if @EQUAL(@HEX(%%ret),4000)
info Current Priority is Below Normal
end
if @EQUAL(@HEX(%%ret),0020)
info Current Priority is Normal
end
if @EQUAL(@HEX(%%ret),8000)
info Current Priority is Above Normal
end
if @EQUAL(@HEX(%%ret),80)
info Current Priority is High
end
if @EQUAL(@HEX(%%ret),100)
info Current Priority is Realtime
end
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
GregLand Valued Contributor


Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Thu Sep 08, 2005 5:09 am Post subject: |
|
|
Very good !!! Thanks...
Is it possible to change the process of the current active window with this mean ? |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Sep 08, 2005 3:52 pm Post subject: |
|
|
No, you would have to have a handle to that specific process.
As far as I know you can't really do it in VDS as you need arrays and pointers _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
GregLand Valued Contributor


Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Thu Sep 08, 2005 3:57 pm Post subject: |
|
|
Thanks a lot SnarlingSheep for your answer...
I will arrange myself with that...
I understand more the API now  |
|
| Back to top |
|
 |
|