开发者

Python and win32 API - using a C file

开发者 https://www.devze.com 2023-01-21 22:29 出处:网络
With ActiveState Python comes a win32api module. I need to implement something that monitors directories recursively for file-changes. Actually there\'s an example in the MSDN library using C. I don\'

With ActiveState Python comes a win32api module. I need to implement something that monitors directories recursively for file-changes. Actually there's an example in the MSDN library using C. I don't know whether the win32api bindings are sufficient for something like this.

Can I import this into a Python project? Because it may be easier to write the file-alteration monitor itself in C, and to handle the results within Python. The problem is: how do I make that interact with开发者_Go百科 each other.


Why not try some of the python win32 examples here. It uses pywin32 and does what you want.

  • http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html

The "C" code that you have mentioned with link to MSDN uses FindFirstChangeNotification. Tim Golden's example uses the same through python win32 bindings. I guess this is what you want.

All windows APIs are exposed and can be utilized via pywin32.


Read the documentation and try it out for yourself. win32file.FindFirstChangeNotification, etc. are there and work.

0

精彩评论

暂无评论...
验证码 换一张
取 消