Hi NS,
> I have a addin which when clicked should open a pdf document, may be
> outside
> Visaul Studio IDE.
>
> How can I do it??? I would appreciate if someone can suggest me something.
By coincidence we already do this in one of our products. The code to open a
URL (including PDF documents) within the internal Visual Studio browser is:
EnvDTE::WindowsPtr ptrWindows = m_pDTE->GetWindows();
IfNullIssueError(ptrWindows);
// Get the first window that's a browser.
EnvDTE::WindowPtr ptrBrowserWindow = ptrWindows->Item(
CComVariant(CComBSTR(EnvDTE::vsWindowKindWebBrowser) ) );
IfNullIssueError(ptrBrowserWindow);
// Force the window to be visible.
ptrBrowserWindow->PutVisible(true);
// Retrieve an interface to the Internet Explorer control inside the
browser window.
SHDocVw::IWebBrowser2Ptr ptrBrowser =
(SHDocVw::IWebBrowser2Ptr)ptrBrowserWindow->GetObject();
// Navigate to the URL
hr = ptrBrowser->Navigate( _bstr_t(sUrl), // Target URL
NULL, // Flags
NULL, // Target frame name
NULL, // PostData
NULL); // Headers
Hope that helps!
Kind Regards,
Anna-Jayne Metcalfe
Software/Product Development Consultant,
Riverblade Limited.
http://www.riverblade.co.uk