[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

CD checking on background

Posted on 2003-11-18
4
Medium Priority
?
254 Views
Last Modified: 2010-04-05
I'm writing a program which should stay invisible on the background and do a check whenever a CD is inserted or changed. For autorun CD's my program should prevent the autorun. Then if the inserted CD contains a certain file (or group of files) the program should perform some actions. Easy example of this could be a window which would automatically pop up and list all files on the root directory of CD with extension *.dpr whenever a CD is changed.

There are certain cases that makes this a bit difficult:

1. If the autoplay is ON the program should catch the QueryCancelAutoPlay Message and not let the autorun application start, but I think that this message gets processed only if my program is active. So the first question is how to make an invisible application to handle this?
2. If the autoplay is OFF the program should check for CD insert notification. Currently my program uses just timer to check for files on the CD every 1000ms, but this is certainly not the best approach.

Sorry for my bad english...

-Jouni-
0
Comment
Question by:jo_re
2 Comments
 

Author Comment

by:jo_re
ID: 9810505
I raised the points for this question because nobody seems to be interested in answering this. I'm sorry if the points are still not enough to get you interested...
0
 
LVL 1

Accepted Solution

by:
Vihmapuu earned 800 total points
ID: 9826359
type
TMyThread=class(TThread)
  procedure Execute;
end;

procedure TMyThread.Execute;
  begin
    while not Terminated do
      begin
        //do your CD checking here
        Sleep(1000);  //milliseconds of how much you want to wait before next turn
      end;
  end;

begin
  //this is how you would start your thread
  with TMyThread.Create(true) do
    begin
      Priority:=tpLower;
      FreeOnTerminate:=true;
      Resume;
    end;
end;

The code above will create a low priority thread that would be working on background.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

834 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