// IOleInPlaceFrame Implementation public int SetActiveObject(IOleInPlaceActiveObject pActiveObject, String pszObjName) { try { if (pActiveObject == null) { container.releaseWndProc(); if (this.activeObject != null) { Marshal.ReleaseComObject(this.activeObject); } this.activeObject = null; this.m_docHwnd = IntPtr.Zero; this.mFullyActive = false; } else { this.activeObject = pActiveObject; this.m_docHwnd = new IntPtr(); pActiveObject.GetWindow(ref this.m_docHwnd); this.mFullyActive = true; //we have the handle to the doc so set up WndProc override container.setupWndProc(); } } catch (Exception e) { Debug.WriteLine("Exception: " + e.Message + e.StackTrace); } return(HRESULT.S_OK); }
int IDocHostUIHandler.ShowUI(int dwID, IOleInPlaceActiveObject activeObject, IOleCommandTarget commandTarget, IOleInPlaceFrame frame, IOleInPlaceUIWindow doc) { //activeObject.GetWindow should return Internet Explorer_Server hwnd if (activeObject != null) { activeObject.GetWindow(ref m_hWBServerHandle); } return(Hresults.S_OK); }
public int SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider psp) { _serviceProvider = new MyServiceProvider(psp); System.Reflection.MethodInfo mi = _typeQB.GetMethod("Init", System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, new Type[] { typeof(System.IServiceProvider), typeof(string) }, null); mi.Invoke(_queryDesigner, new object[] { _serviceProvider, _view.SqlText }); _qbole = _typeQB.InvokeMember("OleCommandTarget", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetProperty, null, _queryDesigner, null) as IOleCommandTarget; _qbbase = _typeQB.InvokeMember("OleInPlaceActiveObject", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetProperty, null, _queryDesigner, null) as IOleInPlaceActiveObject; return(VSConstants.S_OK); }
public void ShowUI(uint dwID, IOleInPlaceActiveObject pActiveObject, IOleCommandTarget pCommandTarget, IOleInPlaceFrame pFrame, IOleInPlaceUIWindow pDoc) { // TODO: is this okay? throw new NotImplementedException(); }
uint IDocHostUIHandler.ShowUI(uint dwID, IOleInPlaceActiveObject pActiveObject, IOleCommandTarget pCommandTarget, IOleInPlaceFrame pFrame, IOleInPlaceUIWindow pDoc) { return(S_FALSE); }
public static extern int OleSetMenuDescriptor(IntPtr holemenu, IntPtr hwndFrame, IntPtr hwndActiveObject, ref IOleInPlaceFrame lpFrame, ref IOleInPlaceActiveObject lpActiveObj);
public void CloseDocument() { try { container.releaseWndProc(); container.Resize -= new EventHandler(this.Container_Resize); if (m_document == null) { return; } try { //this may raise an exception, however it does work and must //be called if (view != null) { view.Show(-1); view.UIActivate(-1); view.SetInPlaceSite(null); view.CloseView(0); } } catch (Exception e) { Debug.WriteLine("CloseView raised exception: " + e.Message); } try { //this could raise an exception too, but it must be called m_document.Close((int)tagOLECLOSE.OLECLOSE_NOSAVE); } catch (Exception e) { Debug.WriteLine("Close document raised exception: " + e.Message); } m_document.SetClientSite(null); win32.OleLockRunning(m_document, false, false); if (this.iAdviseCookie != 0) { m_document.Unadvise(this.iAdviseCookie); } if (this.iEventsCookie != 0) { m_document.Unadvise(this.iEventsCookie); } if (this.iPropertyNotifyCookie != 0) { m_document.Unadvise(this.iPropertyNotifyCookie); } if (container.changeCookie != 0) { ((IMarkupContainer2)m_document).UnRegisterForDirtyRange(container.changeCookie); container.changeCookie = 0; } //release COM objects int RefCount = 0; if (m_document != null) { do { RefCount = Marshal.ReleaseComObject(m_document); } while (RefCount > 0); } if (view != null) { do { RefCount = Marshal.ReleaseComObject(view); } while (RefCount > 0); } if (activeObject != null) { do { RefCount = Marshal.ReleaseComObject(activeObject); } while (RefCount > 0); } m_document = null; view = null; activeObject = null; container.mHtmlDoc = null; container.mDocHTML = null; } catch (Exception e) { Debug.WriteLine("CloseDocument raised exception: " + e.Message); } }
public int ShowUI(int dwID, IOleInPlaceActiveObject activeObject, IOleCommandTarget commandTarget, IOleInPlaceFrame frame, IOleInPlaceUIWindow doc) { return(1); }
public int ShowUI(int dwID, IOleInPlaceActiveObject activeObject, IOleCommandTarget commandTarget, IOleInPlaceFrame frame, IOleInPlaceUIWindow doc) { //Debug.WriteLine("ShowUI"); return HRESULT.S_OK; }
// IOleInPlaceFrame Implementation public int SetActiveObject(IOleInPlaceActiveObject pActiveObject, String pszObjName) { try { if (pActiveObject == null) { container.releaseWndProc(); if (this.activeObject != null) { Marshal.ReleaseComObject(this.activeObject); } this.activeObject = null; this.m_docHwnd = IntPtr.Zero; this.mFullyActive = false; } else { this.activeObject = pActiveObject; this.m_docHwnd = new IntPtr(); pActiveObject.GetWindow(ref this.m_docHwnd); this.mFullyActive = true; //we have the handle to the doc so set up WndProc override container.setupWndProc(); } } catch (Exception e) { Debug.WriteLine("Exception: " + e.Message + e.StackTrace); } return HRESULT.S_OK; }
public int OnInPlaceDeactivate() { activeObject = null; return HRESULT.S_OK; }
public void CloseDocument() { try { container.releaseWndProc(); container.Resize -= new EventHandler(this.Container_Resize); if (m_document == null) return; try { //this may raise an exception, however it does work and must //be called if (view != null) { view.Show(-1); view.UIActivate(-1); view.SetInPlaceSite(null); view.CloseView(0); } } catch (Exception e) { Debug.WriteLine("CloseView raised exception: " + e.Message); } try { //this could raise an exception too, but it must be called m_document.Close((int)tagOLECLOSE.OLECLOSE_NOSAVE); } catch (Exception e) { Debug.WriteLine("Close document raised exception: " + e.Message); } m_document.SetClientSite(null); win32.OleLockRunning(m_document, false, false); if (this.iAdviseCookie != 0) { m_document.Unadvise(this.iAdviseCookie); } if (this.iEventsCookie != 0) { m_document.Unadvise(this.iEventsCookie); } if (this.iPropertyNotifyCookie != 0) { m_document.Unadvise(this.iPropertyNotifyCookie); } if (container.changeCookie != 0) { ((IMarkupContainer2)m_document).UnRegisterForDirtyRange(container.changeCookie); container.changeCookie = 0; } //release COM objects int RefCount = 0; if (m_document != null) do { RefCount = Marshal.ReleaseComObject(m_document); } while (RefCount > 0); if (view != null) do { RefCount = Marshal.ReleaseComObject(view); } while (RefCount > 0); if (activeObject != null) do { RefCount = Marshal.ReleaseComObject(activeObject); } while (RefCount > 0); if (snapper != null) { IntPtr ppinterface = Marshal.GetComInterfaceForObject(snapper, typeof(IHTMLEditHost)); if (ppinterface != null) { do { RefCount = Marshal.Release(ppinterface); } while (RefCount > 0); } snapper = null; } m_document = null; view = null; activeObject = null; container.mHtmlDoc = null; container.mDocHTML = null; } catch (Exception e) { Debug.WriteLine("CloseDocument raised exception: " + e.Message); } }
public int ShowUI(int dwID, IOleInPlaceActiveObject activeObject, IOleCommandTarget commandTarget, IOleInPlaceFrame frame, IOleInPlaceUIWindow doc) { return 1; }
public void ShowUI(uint dwID, IOleInPlaceActiveObject pActiveObject, IOleCommandTarget pCommandTarget, IOleInPlaceFrame pFrame, IOleInPlaceUIWindow pDoc) { }
public int ShowUI(int dwID, IOleInPlaceActiveObject activeObject, Object /* IOleCommandTarget */ commandTarget, IOleInPlaceFrame frame, Object doc) { return(HRESULT.S_OK); }
public int SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider psp) { _serviceProvider = new MyServiceProvider(psp); System.Reflection.MethodInfo mi = _typeQB.GetMethod("Init", System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, new Type[] { typeof(System.IServiceProvider), typeof(string) }, null); mi.Invoke(_queryDesigner, new object[] { _serviceProvider, _view.SqlText }); _qbole = _typeQB.InvokeMember("OleCommandTarget", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetProperty, null, _queryDesigner, null) as IOleCommandTarget; _qbbase = _typeQB.InvokeMember("OleInPlaceActiveObject", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetProperty, null, _queryDesigner, null) as IOleInPlaceActiveObject; return VSConstants.S_OK; }
uint IDocHostUIHandler.ShowUI(uint dwID, IOleInPlaceActiveObject pActiveObject, IOleCommandTarget pCommandTarget, IOleInPlaceFrame pFrame, IOleInPlaceUIWindow pDoc) { return S_FALSE; }
int IDocHostUIHandler.ShowUI(int dwID, IOleInPlaceActiveObject activeObject, IOleCommandTarget commandTarget, IOleInPlaceFrame frame, IOleInPlaceUIWindow doc) { //activeObject.GetWindow should return Internet Explorer_Server hwnd if (activeObject != null) activeObject.GetWindow(ref m_hWBServerHandle); return Hresults.S_OK; }
/// <summary> /// In-place object notification that it is going active or inactive (opportunity for /// us to save a reference to the IOleInPlaceActiveObject and/or release references /// to previously active objects /// </summary> /// <param name="pActiveObject">in-place object becoming active</param> /// <param name="pszObjName">display name of object becoming active</param> public void SetActiveObject(IOleInPlaceActiveObject pActiveObject, string pszObjName) { // log access to method string args = pActiveObject != null ? "object" : "null"; LOG("IOleInPlaceFrame", "SetActiveObject(" + args + ")"); // set the new object only if it is truely new if (oleInPlaceActiveObject != pActiveObject) { // release existing object if necessary if (oleInPlaceActiveObject != null) Marshal.ReleaseComObject(oleInPlaceActiveObject); // set new object oleInPlaceActiveObject = pActiveObject; } }
/// <summary> /// Called by MSHTML to enable the host to replace MSHTML menus and toolbars /// </summary> /// <param name="dwID">DWORD that receives a DOCHOSTUITYPE value indicating the type of user interface (UI)</param> /// <param name="pActiveObject">Pointer to an IOleInPlaceActiveObject interface for the active object</param> /// <param name="pCommandTarget">Pointer to an IOleCommandTarget interface for the object</param> /// <param name="pFrame">Pointer to an IOleInPlaceFrame interface for the object. Menus and toolbars must use this parameter</param> /// <param name="pDoc">Pointer to an IOleInPlaceUIWindow interface for the object. Toolbars must use this parameter</param> /// <returns>S_OK -- Host displayed its own UI. MSHTML will not display its UI. /// S_FALSE -- Host did not display its own UI. MSHTML will display its UI</returns> int IDocHostUIHandler2.ShowUI(DOCHOSTUITYPE dwID, IOleInPlaceActiveObject pActiveObject, IOleCommandTarget pCommandTarget, IOleInPlaceFrame pFrame, IOleInPlaceUIWindow pDoc) { // Host did not display any UI. MSHTML will display its UI. return HRESULT.S_FALSE; }
public int ShowUI(DOCHOSTUITYPE dwID, IOleInPlaceActiveObject pActiveObject, IOleCommandTarget pCommandTarget, IOleInPlaceFrame pFrame, IOleInPlaceUIWindow pDoc) { // log access to method LOG("IDocHostUIHandler", "ShowUI"); return docHostUIHandler.ShowUI(dwID, pActiveObject, pCommandTarget, pFrame, pDoc); }
public int OnInPlaceDeactivate() { activeObject = null; return(HRESULT.S_OK); }
public virtual int ShowUI(DOCHOSTUITYPE dwID, IOleInPlaceActiveObject pActiveObject, IOleCommandTarget pCommandTarget, IOleInPlaceFrame pFrame, IOleInPlaceUIWindow pDoc) { // Host did not display any UI. MSHTML will display its UI. return(HRESULT.S_FALSE); }
public int ShowUI(int dwID, IOleInPlaceActiveObject activeObject, IOleCommandTarget commandTarget, IOleInPlaceFrame frame, IOleInPlaceUIWindow doc) { //Debug.WriteLine("ShowUI"); return(HRESULT.S_OK); }
public virtual int ShowUI( int dwID, IOleInPlaceActiveObject activeObject, IOleCommandTarget commandTarget, IOleInPlaceFrame frame, IOleInPlaceUIWindow doc) { return HResult.S_OK; }