hi, here is an example, sorry for the dirty code:
http://www.howtodothings.com/ViewArticle.aspx?Article=80 regards rene On 8/2/2005, "Brad Hall" <[EMAIL PROTECTED]> wrote: >Sorry bout the confusion w/ the name of the API I specified - I was >thinking about FindFirstChangeNotification when I wrote the e-mail, when >I wanted to write "ReadDirectoryChanges" instead!! > >That's what I'm actually after, the API "ReadDirectoryChanges"... > > > >Thanks. > > > >________________________________ > >From: [email protected] [mailto:[EMAIL PROTECTED] On >Behalf Of Rob Kennedy >Sent: Tuesday, 2 August 2005 5:48 AM >To: [email protected] >Subject: Re: [delphi-en] ReadChangeNotification API > > > >Brad Hall wrote: >> Does anyone have any eg's of the "ReadChangeNotification" Win API? I >> want to implement it into a prog I have, but the Web hasn't been as >> helpful as I thought on this one... > >Perhaps that's because there's no such thing as ReadChangeNotification. > >Try you search using the correct name, FindFirstChangeNotification, and >see whether that helps. > >Also try the classes in the VirtualShellNotifier unit, part of Jim >Kueneman's free Virtual Shell Tools package. > >http://www.mustangpeak.net/ > >> And does the API run in the background of my prog so that my prog can >> continue to execute as normal, or am I going to have to thread the API >> call (I read something about a Wait state)? > >FindFirstChangeNotification returns a handle. To be notified that a >change has occured, you need to wait on that handle. WaitForSingleObject > >is the easiest way to wait, but it's also a blocking call. The thread >that calls that function won't do anything else until the change >notification is satisfied, so you'll need to use a separate thread for >that. > >When your program terminates, you'll want to tell the waiting thread >that it should stop waiting. To do that, you'll need to have a way of >waking it up without changing the file system. Instead of >WaitForSingleObject, use WaitForMultipleObjects. In addition to the >change-notification handle, you can also use an event handle (see >CreateEvent). When the main thread want the notification thread to >terminate, it can signal the event, which will cause >WaitForMultipleObjects to stop waiting. > >There is a way to do all this without a separate thread, but it gets >much more complicated, and Delphi wasn't really designed to work this >way. You can wait on handles while still handling messages y calling >MsgWaitForMultipleObjects. It stops blocking when a message arrives, at >which point you can call Application.ProcessMessages and then resume >waiting. If you have a dialog box or modal form open, then there is a >separate message loop active, and that loop doesn't know about the >handles you're waiting on, so certain events might go unnotices for a >while. I think a separate thread is much easier to work with. > >-- >Rob > > >----------------------------------------------------- >Home page: http://groups.yahoo.com/group/delphi-en/ >To unsubscribe: [EMAIL PROTECTED] > > > > >________________________________ > >YAHOO! GROUPS LINKS > > > >* Visit your group "delphi-en ><http://groups.yahoo.com/group/delphi-en> " on the web. > >* To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] ><mailto:[EMAIL PROTECTED]> > >* Your use of Yahoo! Groups is subject to the Yahoo! Terms of >Service <http://docs.yahoo.com/info/terms/> . > > > >________________________________ > > > >[Non-text portions of this message have been removed] > > > > >----------------------------------------------------- >Home page: http://groups.yahoo.com/group/delphi-en/ >To unsubscribe: [EMAIL PROTECTED] >Yahoo! Groups Links > > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hkpcceu/M=362329.6886308.7839368.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1122979375/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992 ">Fair play? Video games influencing politics. Click and talk back!</a>.</font> --------------------------------------------------------------------~-> ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

