Solved

Time Critical Apps

Posted on 1999-01-22
4
188 Views
Last Modified: 2010-04-06
I am looking for a way to force windows to check an application within a certain period.

This does not need to be particularly fast, say every 20milliseconds, but it must occur every 20ms. I don't want other programs to come along and take over processor time such that it turns into 30ms or anything like that

any ideas... I am fairly new at Delphi but want to investigate this

0
Comment
Question by:jaredc071598
[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
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1362775
What you can do is increase the process priority.
Take a look at the API below.
BOOL SetPriorityClass(  HANDLE hProcess,        // handle to the process
  DWORD dwPriorityClass   // priority class value);

0
 
LVL 20

Expert Comment

by:Madshi
ID: 1362776
Yes, and SetThreadPriority(GetCurrentThread,...).
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1362777
Madshi, you are right.
The priority of the thread is the combination of the thread priority and the process priority. Note that it is a relative number so if somebody has a higher number you are still not garanteed to receive focus every 20ms.

Usually I search for other solutions. Priorities are dirty. If you need it to access hardware, see if there is a buffer. That is much more useful
0
 

Accepted Solution

by:
Almighty_Phoenix earned 100 total points
ID: 1362778
Use the API !

An Example !

uses mmsystem;

var FID:Integer;                 // Handle of MMTimer

procedure TimeCallback(TimerID, Msg:UINT; dwUser, dw1,dw2:DWORD); pascal;
begin
  // your time critical work
end;

// This initializing the Timer
procedure TForm1.RunTimer;
begin
  FID := timeSetEvent(100,0,@TimeCallback,0,TIME_PERIODIC);
end;
// first (100) is the interval (ms)
// second (0) is the accuracy of timer (0 is max)
// third is your callback procedure (not a method !!!)
// 0 is a optional value
// last can be set TIME_ONESHOT (one event) or TIME_PERIODIC
//                                             (intervals)


// This stop the Timer
procedure TForm1.StopTimer;
begin
  if boolean(FID) then timeKillEvent(FID);
end;







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

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…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

691 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