Solved

CD checking on background

Posted on 2003-11-18
4
246 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
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

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.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

830 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