Hi Ten
Hi Ten

Reputation: 93

Visual Studio - File Open And Close Action Trigger

I am working on a project where the challenge to track the file open / closed by user in Visual Studio IDE > Solution explorer and write it in notepad with file name.

Can any one suggest some idea to achieve the same.

Thanks in Advance.

Upvotes: 0

Views: 427

Answers (2)

Sergey Vlasov
Sergey Vlasov

Reputation: 27930

You can subscribe to DTE.Events.DocumentEvents DocumentOpened and DocumentClosing events from a Visual Studio extension to track them.

Upvotes: 2

Alex Guteniev
Alex Guteniev

Reputation: 13719

For such tasks, two approaches my work.

One is to get this from extension API, if developers provisioned such possibility. So, for Visual Studio, check Visual Studio SDK, if it provides method for this.

Another one is events monitoring approach, that is applicable to many applications. You will need to use Process Monitor and/or Spy++ to identify some events that will be used to identify opening and closing a file. Then further steps depend on event of interenst, it may be file change notification, windows hooks, API hooks, etc.

Upvotes: 1

Related Questions