Solved

Higher program importance

Posted on 2004-04-16
6
266 Views
Last Modified: 2010-04-05
Hi

    I've built myself an ACE little music player, which works brilliantly except when my computer gets busy (for example opening Delphi) when it pauses or stops playing? Is there any way around this? Can I set my program to have higher importance? So it wont get interrupted by heavy CPU usage?

Thanks in advance

David Birch
0
Comment
Question by:DavidBirch2dotCom
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 75 total points
ID: 10841248
Hi,
try this

SetPriorityClass( GetCurrentProcess,ABOVE_NORMAL_PRIORITY_CLASS);
or
SetPriorityClass( GetCurrentProcess,HIGH_PRIORITY_CLASS);
or
SetPriorityClass( GetCurrentProcess,REALTIME_PRIORITY_CLASS);
0
 
LVL 7

Author Comment

by:DavidBirch2dotCom
ID: 10841266
thanks mokule

when should i call that?

which would you suggest for a music player?

what is realtime?

David

0
 
LVL 17

Expert Comment

by:mokule
ID: 10841310
When?
Before start playing

You must try what give You best results. Though REALTIME_PRIORITY_CLASS rather not.


REALTIME_PRIORITY_CLASS

Process that has the highest possible priority. The threads of the process preempt the threads of all other processes, including operating system processes performing important tasks. For example, a real-time process that executes for more than a very brief interval can cause disk caches not to flush or cause the mouse to be unresponsive

More read there

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/setpriorityclass.asp
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 7

Author Comment

by:DavidBirch2dotCom
ID: 10841333
ok i wondered if i might need to call it in the project source part. Realtime sounds very dangerous so i will go with ,HIGH_PRIORITY which works great!

thanks

Mokule
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10841347
 The values are :

  1) REALTIME_PRIORITY_CLASS
  2) HIGH_PRIORITY_CLASS
  3) ABOVE_NORMAL_PRIORITY_CLASS
  4) NORMAL_PRIORITY_CLASS
  5) BELOW_NORMAL_PRIORITY_CLASS
  6) IDLE_PRIORITY_CLASS


  You can see in Winamp options that there is option for REAL TIME PRIORITY, but :
     1) It is not recommended
     2) Don't help

  The problem is in the way Windows manages the drives. It you read/write to HDD, CD Winmdmt.exe process takes very high CPU time.

   I don't agree with module that real time priority is good. It will cause you system to stuck for few moments. In my opinion the system processes are more important that yours, so you should let it function normally.

   Quote mokule :
   "For example, a real-time process that executes for more than a very brief interval can cause disk caches not to flush or cause the mouse to be unresponsive"...

   It can slow your mouse and disk activity - not good idea....

0
 
LVL 17

Expert Comment

by:mokule
ID: 10841392
Hi Ivanov

I've never said that real-time will be good.

You can find also this my quote :)
"You must try what give You best results. Though REALTIME_PRIORITY_CLASS rather not."
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 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