Solved

Thread of task manager

Posted on 2006-11-22
6
318 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 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now