Solved

CD checking on background

Posted on 2003-11-18
4
242 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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now