Thanks for that Rene :-)
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Rene Tegel Sent: Tuesday, 2 August 2005 6:47 PM To: [email protected] Subject: RE: [delphi-en] ReadChangeNotification API 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 > > > > > > ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] SPONSORED LINKS C programming language <http://groups.yahoo.com/gads?t=ms&k=C+programming+language&w1=C+program ming+language&w2=Computer+programming+languages&w3=The+c+programming+lan guage&w4=C+++programming+language&w5=List+of+programming+languages&w6=De lphi+programmer&c=6&s=184&.sig=LmB2di4FcYmWuZp0shJnNQ> Computer programming languages <http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=C +programming+language&w2=Computer+programming+languages&w3=The+c+program ming+language&w4=C+++programming+language&w5=List+of+programming+languag es&w6=Delphi+programmer&c=6&s=184&.sig=V1W6zeXWRB5aPckCzpGn7g> The c programming language <http://groups.yahoo.com/gads?t=ms&k=The+c+programming+language&w1=C+pro gramming+language&w2=Computer+programming+languages&w3=The+c+programming +language&w4=C+++programming+language&w5=List+of+programming+languages&w 6=Delphi+programmer&c=6&s=184&.sig=sF05g5hAk_PFYg_GHTdoDw> C programming language <http://groups.yahoo.com/gads?t=ms&k=C+++programming+language&w1=C+progr amming+language&w2=Computer+programming+languages&w3=The+c+programming+l anguage&w4=C+++programming+language&w5=List+of+programming+languages&w6= Delphi+programmer&c=6&s=184&.sig=ozakmf9uST51B-nw36av8A> List of programming languages <http://groups.yahoo.com/gads?t=ms&k=List+of+programming+languages&w1=C+ programming+language&w2=Computer+programming+languages&w3=The+c+programm ing+language&w4=C+++programming+language&w5=List+of+programming+language s&w6=Delphi+programmer&c=6&s=184&.sig=nlAu1WndOIvIj2gUxPWE4A> Delphi programmer <http://groups.yahoo.com/gads?t=ms&k=Delphi+programmer&w1=C+programming+ language&w2=Computer+programming+languages&w3=The+c+programming+language &w4=C+++programming+language&w5=List+of+programming+languages&w6=Delphi+ programmer&c=6&s=184&.sig=gwVtU7lT_-8Af3_93Nz4Lw> ________________________________ 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] ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hrv23et/M=362329.6886308.7839368.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1123033162/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/

