Can't get IVsTextLinesEvents for HTML/ASPX documents
-
Friday, September 14, 2012 6:14 AM
Using C++, I'm listening for IVsTextLinesEvents events, and it works just fine for most file types (C++/C#/VB). However for HTML and ASPX files, I can't find a connection point, so I can't advise. A simplified example (with no error handling) is below. Is it possible to get these events for these file types? Thanks!
void TextEventsListener::Connect(VSCOOKIE docCookie)
{
CComPtr<IVsRunningDocumentTable> rdt = GetIVsRunningDocumentTable();
CComPtr<IUnknown> buffer;
rdt->GetDocumentInfo(docCookie, NULL, NULL, NULL, NULL, NULL, NULL, &buffer);
CComQIPtr<IConnectionPointContainer> ptCon(buffer);
CComPtr<IConnectionPoint> pt;
// This line fails for HTML and ASPX files
ptCon->FindConnectionPoint(IID_IVsTextLinesEvents, &pt);
pt->Advise((IVsTextLinesEvents *)this, &mLinesEventCookie);
}
All Replies
-
Monday, September 17, 2012 5:42 AMModerator
Hi Mark,
Can the function of Connect be called?
Can we get the RDT of HTML and ASPX files well?
We can use IsDocDataReloadable(Int32%) to determine it.
If we set some breakpoints and debug it, can we found what causes your issue?
Ego [MSFT]
MSDN Community Support | Feedback to us
-
Monday, September 17, 2012 9:50 PMModerator
The HTML/ASPX stuff implement IVsTextBufferProvider, you need to cast the buffer object returned from the RDT to that, ask it for the real buffer and then go down the IConnectionPointContianer route.
Ryan
- Marked As Answer by mark.deggeller.wt Tuesday, September 18, 2012 3:36 AM
-
Tuesday, September 18, 2012 3:36 AM
Thanks, Ryan. That did it!

