Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Thread of task manager

Posted on 2006-11-22
6
Medium Priority
?
338 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 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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

704 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