Solved

CD checking on background

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

Independent Software Vendors: 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

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…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

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