Solved

CD checking on background

Posted on 2003-11-18
4
247 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
[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
4 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 200 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

731 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