Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
when a file is created/wrote/pasted in/to a folder by anyone, i want to stop this process and create/write/paste this file to that folder after encrypting with pgp. but i don't know how to stop file creating and writing. i write in c#.

addition:
according to me, my problem is not about copy and paste events. i think the solution is file system monitor and stopping file creation and writing. but how can i do this? is there any sample code?
Posted
Updated 9-Feb-10 21:18pm
v3

This isn't something you can do with C#. I believe you'll need to write a file system filter driver. A global keyboard hook won't work because it won't stop other triggers for write operations like copy/pasting with the mouse.

You can start reading about file system filter drivers here: http://www.microsoft.com/whdc/driver/filterdrv/default.mspx[^]
 
Share this answer
 
v2
You'd have to write a system wide keyboard hook that captures the paste, reject it, work out what's in the clipboard, and then do your operation to it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900