Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / December 2005

Tip: Looking for answers? Try searching our database.

How to get notified when a document is opened for editing in the IDE?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dmitry Shaporenkov - 02 Mar 2005 16:55 GMT
Hi all,

what is the best way to get notified when a document is opened for editing
is the IDE?
More precisely, I need a notification that a new IVsTextBuffer is created
inside the environment,
and this IVsTextBuffer is intended for in-memory editing.

I'm currrently going to use IVsRunningDocumentTableEvents.OnAfterFirstDocumentLock
callback for this
purpose, is it the right choice?

Thanks in advance.

Regards,
Dmitry Shaporenkov
Sergey M - 02 Mar 2005 18:29 GMT
> what is the best way to get notified when a document is opened for
> editing is the IDE?

I use IVsRunningDocTableEvents interface and
OnBeforeDocumentWindowShow() method in particular. fFirstShow flag is
the one you'd be interested in. It'd be set to true (1) whenever the
document is opened for the first time, or false (0) when user clicks on
document that's been previously opened.

Hope this helps.
Signature

Sergey M
http://www.usysware.com/dpack/ - VS.NET package/add-ins
http://www.usysware.com/blog/

Dmitry Shaporenkov - 03 Mar 2005 11:07 GMT
Hello Sergey,

yes, you're right, thank you. However, I'm equally interested to get notified
when a document
is about to close, and OnAfterDocumentWindowHide does not work right for
this purpose, because
it seems to get called each time when a document window loses focus (and
there is no magic flag
fLastHide there :)).

Any ideas how to catch document closing?

Regards,
Dmitry Shaporenkov

>> what is the best way to get notified when a document is opened for
>> editing is the IDE?
[quoted text clipped - 6 lines]
>
> Hope this helps.
Sergey M - 09 Mar 2005 16:52 GMT
Dmitry,

Sorry it took me so long to reply.

> Any ideas how to catch document closing?

Not directly, I'm afraid. The only time I needed that is when a
document with my custom marker was about to close. Luckily
IVsTextMarkerClient.OnBeforeBufferClose() was readily available to me.
Signature

Sergey Mishkovskiy
http://www.usysware.com/dpack/ - free VS.NET add-ons
http://www.usysware.com/blog/

Dmitry Shaporenkov - 10 Mar 2005 09:01 GMT
Hello Sergey,

thank you for your information. I'm now trying to use IVsRunningDocumentTableEvents.OnAfterLastDocumentUnlock,
let's see how it will work.

Regards,
Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

> Dmitry,
>
[quoted text clipped - 5 lines]
> document with my custom marker was about to close. Luckily
> IVsTextMarkerClient.OnBeforeBufferClose() was readily available to me.
Marko_metronik - 07 Dec 2005 09:45 GMT
Hello sorry for the use of your thread:)

How can you subscribe to the IVsRunningDocTableEvents interface and
OnBeforeDocumentWindowShow() method. I have no idea how to get event
notification. Some sample code would be appreciated.

Thank you.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.