Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Thread of task manager

Posted on 2006-11-22
6
Medium Priority
?
341 Views
Last Modified: 2013-12-03
I have seen that the priority of a threat can be adjusted via task manager. Priority-Normal etc.

Q: Can I use a normal delphi application and predefine the priority via code ( I have not set programed a thread in the app)
Second: Is it possible to start an app via predefined threads e.g. via batch file?

Thanks
0
Comment
Question by:hush021299
6 Comments
 
LVL 19

Expert Comment

by:MerijnB
ID: 17994711
I have some trouble understanding your question:

1) the thread you are talking about, did you make it yourself, if yes, how? Using TThread
2). I don't understand the 2nd one at all :)
0
 
LVL 4

Accepted Solution

by:
tobjectpascal earned 200 total points
ID: 18002808
var
Wnd : hwnd;
ProcessID,cpid : Cardinal;
begin
Wwnd:=Form1.handle; //handle of your app or another
ProcessID := GetWindowThreadProcessID(wnd,@cpid);
SetThreadPriority(ProcessID,THREAD_PRIORITY_LOWEST);

or

THREAD_PRIORITY_ABOVE_NORMAL  
THREAD_PRIORITY_HIGHEST  
THREAD_PRIORITY_NORMAL  
THREAD_PRIORITY_BELOW_NORMAL  
THREAD_PRIORITY_LOWEST    

0
 
LVL 4

Expert Comment

by:David_Ward
ID: 18006588
@tobjectpascal: <grin> I notice you left out "RealTime", but then, I would NOT advise the use of that one, iether.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:hush021299
ID: 18045522
Sorry I werent around a few days.

The thread I refere is for an external program. Lets say I write program a to display hello world. Executing will display a in the task manager. Here I find a menu for priorisation. As long it runs I can set priority to low.

So, I could think of a tool which starts another program on a different threat, unless this program has been programmed using threads at all.
0
 
LVL 1

Author Comment

by:hush021299
ID: 18045550
I guess the answer from tobjectpascal could do it, unless I dont know the handle of the program before it executes. But then, can I search for the name to get the handle?
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 18045804
yes, you can use FindWindow()
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question