[Win32utils-devel] Need some help with pure Ruby win32-changenotify

Daniel Berger djberg96 at gmail.com
Sat Aug 4 09:20:44 EDT 2007


Hi all,

I know it's deprecated, but people seem to still be using 
win32-changenotify, so I thought I'd see if I could make it pure Ruby. 
Also, I thought it would be a good opportunity to test passing a custom 
Win32::Event object.

I'm mostly done I think, but I'm having trouble unraveling the 
FILE_NOTIFY_INFORMATION struct buffer. Please check out the latest 
lib/win32/changenotify.rb from CVS and take a look at both the custom 
wait method and the get_file_action private method.

The notification is clearly getting picked up, but I'm just not 
unraveling the struct properly.

Here's a little sample program you can use to test:

require 'win32/changenotify'
include Win32

filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME
cn = ChangeNotify.new("C:\\", true, filter)
cn.wait(15){ |x|
    p x
} while true

Then, just make sure to modify some file within the 15 second wait period.

Thanks,

Dan


More information about the win32utils-devel mailing list