monitor if a specific file is accessed

Posted on 2005-03-08
Medium Priority
Last Modified: 2010-04-01
I'm trying to make a program detect when a specific file is accessed (i was thinking of monitoring changes in the lastaccessed attributes) and whenever that happens it should run another program (like a prog.bat) . I'm programming with visual c++ 6.0. Any sugestions? thanks
Question by:jpreis
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 30

Accepted Solution

Axter earned 750 total points
ID: 13490405
Hi jpreis,

I recommend you use the Windows API functions that can do this for you.
See ReadDirectoryChangesW or FindFirstChangeNotification API functions

David Maisonave :-)
LVL 30

Expert Comment

ID: 13490446
LVL 30

Expert Comment

ID: 13490505
here's a wrapper class along with some sample code: http://www.codeproject.com/file/directorychangewatcher.asp

Author Comment

ID: 13901879

thank you for that answer. i completly forgot about this question because i managed to get around that problem. i'm rewarding you for the atention though.


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question