Ejemplo n.º 1
0
 public virtual void CloseDW(uint dwReserved)
 {
     fClosedDW = true;
     ShowDW(false);
     Dispose(true);
     if (Explorer != null)
     {
         Marshal.ReleaseComObject(Explorer);
         Explorer = null;
     }
     if (BandObjectSite != null)
     {
         Marshal.ReleaseComObject(BandObjectSite);
         BandObjectSite = null;
     }
     if (RebarSubclass != null)
     {
         RebarSubclass.ReleaseHandle();
         RebarSubclass = null;
     }
     if (RebarSubclass != null)
     {
         RebarSubclass.ReleaseHandle();
         RebarSubclass = null;
     }
 }
Ejemplo n.º 2
0
 public virtual void SetSite(object pUnkSite)
 {
     if (this.BandObjectSite != null)
     {
         Marshal.ReleaseComObject(this.BandObjectSite);
     }
     if (this.Explorer != null)
     {
         Marshal.ReleaseComObject(this.Explorer);
         this.Explorer = null;
     }
     this.BandObjectSite = pUnkSite as IInputObjectSite;
     if (this.BandObjectSite != null)
     {
         Guid guid = ExplorerGUIDs.IID_IWebBrowserApp;
         Guid riid = ExplorerGUIDs.IID_IUnknown;
         try {
             object obj2;
             ((_IServiceProvider)this.BandObjectSite).QueryService(ref guid, ref riid, out obj2);
             this.Explorer = (WebBrowserClass)Marshal.CreateWrapperOfType(obj2 as IWebBrowser, typeof(WebBrowserClass));
             this.OnExplorerAttached();
         }
         catch (COMException) {
         }
     }
     try {
         BandObjectLib.IOleWindow window = pUnkSite as BandObjectLib.IOleWindow;
         if (window != null)
         {
             window.GetWindow(out this.ReBarHandle);
         }
     }
     catch {
     }
 }
Ejemplo n.º 3
0
        public virtual void SetSite(Object pUnkSite)
        {
            if (inputObjectSite != null)
            {
                Marshal.ReleaseComObject(inputObjectSite);
            }

            if (webBrowserClass != null)
            {
                Marshal.ReleaseComObject(webBrowserClass);
                webBrowserClass = null;
            }

            inputObjectSite = (IInputObjectSite)pUnkSite;

            if (inputObjectSite != null)
            {
                //pUnkSite is a pointer to object that implements IOleWindowSite or something  similar
                //we need to get access to the top level object - explorer itself
                //to allows this explorer objects also implement IServiceProvider interface
                //(don't mix it with System.IServiceProvider!)
                //we get this interface and ask it to find WebBrowserApp
                _IServiceProvider sp = inputObjectSite as _IServiceProvider;
                Guid guid            = ExplorerGUIDs.IID_IWebBrowserApp;
                Guid riid            = ExplorerGUIDs.IID_IUnknown;

                try
                {
                    object w;
                    sp.QueryService(ref guid, ref riid, out w);

                    //once we have interface to the COM object we can create RCW from it
                    webBrowserClass = (WebBrowserClass)Marshal.CreateWrapperOfType(w as IWebBrowser, typeof(WebBrowserClass));

                    if (SetSiteEvent != null)
                    {
                        SetSiteEvent(pUnkSite);
                    }
                }
                catch (COMException)
                {
                    //we anticipate this exception in case our object instantiated
                    //as a Desk Band. There is no web browser service available.
                }
            }
            else
            {
                if (SetSiteEvent != null)
                {
                    SetSiteEvent(pUnkSite);
                }
            }
        }
Ejemplo n.º 4
0
 public virtual void SetSite(Object pUnkSite)
 {
     if (BandObjectSite != null)
     {
         Marshal.ReleaseComObject(BandObjectSite);
     }
     if (_Explorer != null)
     {
         Marshal.ReleaseComObject(_Explorer);
         _Explorer = null;
     }
     BandObjectSite = (IInputObjectSite)pUnkSite;
     QueryExplorerWindow();
 }
Ejemplo n.º 5
0
        public virtual void SetSite(Object pUnkSite)
        {
            if (BandObjectSite != null)
            {
                Marshal.ReleaseComObject(BandObjectSite);
            }

            if (Explorer != null)
            {
                Marshal.ReleaseComObject(Explorer);
                Explorer = null;
            }

            BandObjectSite = (IInputObjectSite)pUnkSite;
            if (BandObjectSite != null)
            {
                //pUnkSite is a pointer to object that implements IOleWindowSite or something  similar
                //we need to get access to the top level object - explorer itself
                //to allows this explorer objects also implement IServiceProvider interface
                //(don't mix it with System.IServiceProvider!)
                //we get this interface and ask it to find WebBrowserApp
                _IServiceProvider sp = BandObjectSite as _IServiceProvider;
                Guid guid            = ExplorerGUIDs.IID_IWebBrowserApp;
                Guid riid            = ExplorerGUIDs.IID_IUnknown;

                try
                {
                    object w;
                    sp.QueryService(
                        ref guid,
                        ref riid,
                        out w);

                    //once we have interface to the COM object we can create RCW from it
                    //Error	8	Interop type 'SHDocVw.WebBrowserClass' cannot be embedded. Use the applicable interface instead.
                    Explorer = (WebBrowserClass)Marshal.CreateWrapperOfType(
                        w as IWebBrowser,
                        typeof(WebBrowserClass)
                        );


                    OnExplorerAttached(EventArgs.Empty);
                }
                catch (COMException)
                {
                    //we anticipate this exception in case our object instantiated
                    //as a Desk Band. There is no web browser service available.
                }
            }
        }
Ejemplo n.º 6
0
 public virtual void CloseDW(uint dwReserved)
 {
     fClosedDW = true;
     ShowDW(false);
     Dispose(true);
     if(Explorer != null) {
         Marshal.ReleaseComObject(Explorer);
         Explorer = null;
     }
     if(BandObjectSite != null) {
         Marshal.ReleaseComObject(BandObjectSite);
         BandObjectSite = null;
     }
     if(RebarSubclass != null) {
         RebarSubclass.Enabled = false;
         RebarSubclass = null;
     }
 }
Ejemplo n.º 7
0
 //IObjectWithSite.SetSite
 public virtual void SetSite(object pUnkSite)
 {
     if (Process.GetCurrentProcess().ProcessName == "iexplore")
     {
         Marshal.ThrowExceptionForHR(E_FAIL);
     }
     if (BandObjectSite != null)
     {
         Marshal.ReleaseComObject(BandObjectSite);
     }
     if (Explorer != null)
     {
         Marshal.ReleaseComObject(Explorer);
         Explorer = null;
     }
     BandObjectSite = pUnkSite as IInputObjectSite;
     if (BandObjectSite != null)
     {
         try
         {
             object obj2;
             ((_IServiceProvider)BandObjectSite).QueryService(ExplorerGUIDs.IID_IWebBrowserApp, ExplorerGUIDs.IID_IUnknown, out obj2);
             Explorer = (WebBrowserClass)Marshal.CreateWrapperOfType(obj2 as IWebBrowser, typeof(WebBrowserClass));
             OnExplorerAttached();
         }
         catch (COMException)
         { // exception
           // QTUtility2.MakeErrorLog(exception, "MSG:" + exception.Message);
         }
     }
     try
     {
         IOleWindow window = pUnkSite as IOleWindow;
         if (window != null)
         {
             window.GetWindow(out ReBarHandle);
         }
     }
     catch (Exception) // exc
     {
         //  logger.Log(exc);
     }
 }
Ejemplo n.º 8
0
 virtual public void QueryExplorerWindow()
 {
     if (BandObjectSite != null)
     {
         _IServiceProvider sp = BandObjectSite as _IServiceProvider;
         Guid guid            = ExplorerGUIDs.IID_IWebBrowserApp;
         Guid riid            = ExplorerGUIDs.IID_IUnknown;
         try
         {
             object w;
             sp.QueryService(ref guid, ref riid, out w);
             //once we have interface to the COM object we can create RCW from it
             _Explorer = (WebBrowserClass)Marshal.CreateWrapperOfType(
                 w as IWebBrowser, typeof(WebBrowserClass));
             OnExplorerAttached(EventArgs.Empty);
         }
         catch (COMException)
         {
         }
     }
 }
Ejemplo n.º 9
0
 public virtual void SetSite(object pUnkSite)
 {
     if (Process.GetCurrentProcess().ProcessName == "iexplore")
     {
         Marshal.ThrowExceptionForHR(E_FAIL);
     }
     if (BandObjectSite != null)
     {
         Marshal.ReleaseComObject(BandObjectSite);
     }
     if (Explorer != null)
     {
         Marshal.ReleaseComObject(Explorer);
         Explorer = null;
     }
     BandObjectSite = pUnkSite as IInputObjectSite;
     if (BandObjectSite != null)
     {
         Guid guid = ExplorerGUIDs.IID_IWebBrowserApp;
         Guid riid = ExplorerGUIDs.IID_IUnknown;
         try {
             object obj2;
             ((_IServiceProvider)BandObjectSite).QueryService(ref guid, ref riid, out obj2);
             Explorer = (WebBrowserClass)Marshal.CreateWrapperOfType(obj2 as IWebBrowser, typeof(WebBrowserClass));
             OnExplorerAttached();
         }
         catch (COMException) {
         }
     }
     try {
         IOleWindow window = pUnkSite as IOleWindow;
         if (window != null)
         {
             window.GetWindow(out ReBarHandle);
         }
     }
     catch {
     }
 }
Ejemplo n.º 10
0
 public virtual void SetSite(object pUnkSite) {
     if(Process.GetCurrentProcess().ProcessName == "iexplore") {
         Marshal.ThrowExceptionForHR(E_FAIL);
     }
     if(BandObjectSite != null) {
         Marshal.ReleaseComObject(BandObjectSite);
     }
     if(Explorer != null) {
         Marshal.ReleaseComObject(Explorer);
         Explorer = null;
     }
     BandObjectSite = pUnkSite as IInputObjectSite;
     if(BandObjectSite != null) {
         Guid guid = ExplorerGUIDs.IID_IWebBrowserApp;
         Guid riid = ExplorerGUIDs.IID_IUnknown;
         try {
             object obj2;
             ((_IServiceProvider)BandObjectSite).QueryService(ref guid, ref riid, out obj2);
             Explorer = (WebBrowserClass)Marshal.CreateWrapperOfType(obj2 as IWebBrowser, typeof(WebBrowserClass));
             OnExplorerAttached();
         }
         catch(COMException) {
         }
     }
     try {
         IOleWindow window = pUnkSite as IOleWindow;
         if(window != null) {
             window.GetWindow(out ReBarHandle);
         }
     }
     catch {
     }
 }
Ejemplo n.º 11
0
        public virtual void SetSite(Object pUnkSite)
        {
            if (BandObjectSite != null)
                Marshal.ReleaseComObject(BandObjectSite);

            if (Explorer != null)
            {
                Marshal.ReleaseComObject(Explorer);
                Explorer = null;
            }

            BandObjectSite = (IInputObjectSite)pUnkSite;
            if (BandObjectSite != null)
            {
                //pUnkSite is a pointer to object that implements IOleWindowSite or something  similar
                //we need to get access to the top level object - explorer itself
                //to allows this explorer objects also implement IServiceProvider interface
                //(don't mix it with System.IServiceProvider!)
                //we get this interface and ask it to find WebBrowserApp
                _IServiceProvider sp = BandObjectSite as _IServiceProvider;
                Guid guid = ExplorerGUIDs.IID_IWebBrowserApp;
                Guid riid = ExplorerGUIDs.IID_IUnknown;

                try
                {
                    object w;
                    sp.QueryService(
                        ref guid,
                        ref riid,
                        out w);

                    //once we have interface to the COM object we can create RCW from it
                    Explorer = (WebBrowserClass)Marshal.CreateWrapperOfType(
                        w as IWebBrowser,
                        typeof(WebBrowserClass)
                        );

                    OnExplorerAttached(EventArgs.Empty);
                }
                catch (COMException)
                {
                    //we anticipate this exception in case our object instantiated
                    //as a Desk Band. There is no web browser service available.
                }
            }
        }
Ejemplo n.º 12
0
 public virtual void SetSite(object pUnkSite) {
     if(this.BandObjectSite != null) {
         Marshal.ReleaseComObject(this.BandObjectSite);
     }
     if(this.Explorer != null) {
         Marshal.ReleaseComObject(this.Explorer);
         this.Explorer = null;
     }
     this.BandObjectSite = pUnkSite as IInputObjectSite;
     if(this.BandObjectSite != null) {
         Guid guid = ExplorerGUIDs.IID_IWebBrowserApp;
         Guid riid = ExplorerGUIDs.IID_IUnknown;
         try {
             object obj2;
             ((_IServiceProvider)this.BandObjectSite).QueryService(ref guid, ref riid, out obj2);
             this.Explorer = (WebBrowserClass)Marshal.CreateWrapperOfType(obj2 as IWebBrowser, typeof(WebBrowserClass));
             this.OnExplorerAttached();
         }
         catch(COMException) {
         }
     }
     try {
         BandObjectLib.IOleWindow window = pUnkSite as BandObjectLib.IOleWindow;
         if(window != null) {
             window.GetWindow(out this.ReBarHandle);
         }
     }
     catch {
     }
 }
Ejemplo n.º 13
0
 public virtual void CloseDW(uint dwReserved) {
     this.fClosedDW = true;
     this.ShowDW(false);
     this.Dispose(true);
     if(this.Explorer != null) {
         Marshal.ReleaseComObject(this.Explorer);
         this.Explorer = null;
     }
     if(this.BandObjectSite != null) {
         Marshal.ReleaseComObject(this.BandObjectSite);
         this.BandObjectSite = null;
     }
     if(this.RebarSubclass != null) {
         this.RebarSubclass.ReleaseHandle();
         RebarSubclass = null;
     }
     if(RebarSubclass != null) {
         RebarSubclass.ReleaseHandle();
         RebarSubclass = null;
     }
 }