Solved

Thread of task manager

Posted on 2006-11-22
6
325 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 50 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
Independent Software Vendors: 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

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!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

752 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