How to tracking user open and close a doc file. RRS feed

  • Question

  • Now, I am developing a education software. We offer a windowsform based application to support offline learning.

    Unlike online learning, we want to record how long dose the student user the resources. So I try to recored the start time and end time of the process that I start for opening the file.

    It works well when the file is opened with the no-reused process application. But when I try to open two doc files, I can not catch the second process I created, because this process will be closed by the first process, and the second doc file will be opened by the first process. In this case, I am failed to record each file's end time, they are all in one process.

    Dose any one has better opinion?  I have searching and thinking it for days.
    Friday, February 12, 2010 2:58 AM

All replies

  • You might want to explore the Word developer reference and see if you can take advantage of the documentation. Maybe you can handle an event and therefore determine when a document was opened or closed.

    Good luck.

    Friday, February 12, 2010 8:11 PM
  • I know there are some weaknesses in this approach but you could create an object with properties for the FileName, UserName, DateOpened, DateClosed, etc....

    When you make your call to open the Word file you could create the aformentioned object with all the details of the file opened, the user opening the file, the time the file is opened and whatever else you want to do and add this object to a List<>. When you go to close the file you could look in the list and find the object that corresponds with the file you are going to close and update the close time and if necessary write that data out to your database or whatever and remove the object from the list.

    One of the weaknesses I talk about is not knowing if the document actually opened. You mentioned that you know when the documents gets opened so maybe you could put the object in the list at that time. Not sure if this is a way to do it but its one way I think could work for you.

    Dewayne Dodd - Landshark Software "Please make sure to 'Mark As Answer' if this answer solves your question"
    • Marked as answer by Aland LiModerator Monday, February 15, 2010 9:47 AM
    • Unmarked as answer by ebread Tuesday, February 23, 2010 6:27 AM
    Friday, February 12, 2010 10:09 PM
  • @LandsharkDaddy

    [When you go to close the file you could look in the list and find the object that corresponds with the file you are going to close and update the close time]

    I am confused how can I know user is closing the application which lauch the file. This is my main question.

    I tried to use process to get the ending event of process, so I get the closeing file time. But it is no use for reused process application.

    And there is also a problem that I do not know the application user uses to open the file. ex. user uses open office open the doc file. So I can not use the Office API.

    @Aland Li
    Sorry, these days are spring festival holiday in China, the most important day to chinese people. So I didn't come here during these days.
    Tuesday, February 23, 2010 6:37 AM