forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Set priority to an active application

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
GregLand
Valued Contributor
Valued Contributor


Joined: 15 Jun 2004
Posts: 212
Location: FRANCE

PostPosted: Thu Sep 08, 2005 2:19 am    Post subject: Set priority to an active application Reply with quote

Hello everybody... Wink
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 ? Embarassed

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
View user's profile Send private message Visit poster's website
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Sep 08, 2005 3:37 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
GregLand
Valued Contributor
Valued Contributor


Joined: 15 Jun 2004
Posts: 212
Location: FRANCE

PostPosted: Thu Sep 08, 2005 5:09 am    Post subject: Reply with quote

Very good !!! Thanks... Laughing

Is it possible to change the process of the current active window with this mean ?
Back to top
View user's profile Send private message Visit poster's website
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Sep 08, 2005 3:52 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
GregLand
Valued Contributor
Valued Contributor


Joined: 15 Jun 2004
Posts: 212
Location: FRANCE

PostPosted: Thu Sep 08, 2005 3:57 pm    Post subject: Reply with quote

Thanks a lot SnarlingSheep for your answer...
I will arrange myself with that... Very Happy

I understand more the API now Wink
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group