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
Solved

Thread of task manager

Posted on 2006-11-22
6
322 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 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