I have two programming challenges which I can't seem to cope with all on my own, so I'd appreciate your help with them. I did some googleing to no avail.
Challenge one: I'd like my programme to present a question to the user when he or she chooses to shut down his or her computer down (or log off). I know there is a way to do that, I just haven't figured it out yet

Challenge two: Is there a way to detect whenever someone opens a file somewhere on the system? All I'd need to know is the name and location of the file, that's all. So my programme would listen for file opens all the time, and be notified when any file is opened. Is there a way to do that?
Thanks a lot!
merendo