Home
Testing 1,2,3... - January 23rd, 2005 [entries|archive|friends|userinfo]
djberg96

[ website | Sapphire ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Links
[Links:| Ruby Home RubyForge RAA comp.lang.ruby Ruby Documentation ]

January 23rd, 2005

win32-changenotify stuff [Jan. 23rd, 2005|06:47 pm]
Tonight's work has consisted of getting more detailed information out of win32-changenotify. This has meant replacing FindFirstChangeNotification() with a CreateFile() + ReadDirectoryChangesW() combination.

It works, except for one thing - I don't know how to setup a timeout for ReadDirectoryChangesW(). That means you can do this:
cn = ChangeNotify.new('C:\',false,flags){ |s|
   puts "Something changed"
   puts "File: " + s.file_name
   puts "Action: " + s.action
}

The problem is that cn.wait doesn't work. Why? Because ReadDirectoryChangesW() doesn't return a HANDLE. It only returns TRUE/FALSE. So, I can get a notification that something has changed, but I don't have anything to pass to a wait function.

I suspect the answer is to use a FileIOCompletionRoutine plus an OVERLAPPED structure, but that is more work than I'm willing to put into this at the moment. For now, it just waits indefinitely.
linkpost comment

navigation
[ viewing | January 23rd, 2005 ]
[ go | Previous Day|Next Day ]

Advertisement