Exemplo n.º 1
0
        private static IDisposableSequence GetActiveExcelApplicationProxiesFromDesktop()
        {
            try
            {
                WindowEnumerator enumerator = new WindowEnumerator("XLMAIN");
                IntPtr[]         handles    = enumerator.EnumerateWindows(2000);
                if (null == handles || handles.Length == 0)
                {
                    return(new DisposableObjectList(null));
                }

                return(ExcelApplicationWindow.GetApplicationProxiesFromHandle(handles));
            }
            catch (Exception exception)
            {
                DebugConsole.Default.WriteException(exception);
                throw;
            }
        }
        private static List <object> GetActiveExcelApplicationProxiesFromROT()
        {
            try
            {
                WindowEnumerator enumerator = new WindowEnumerator("XLMAIN");
                IntPtr[]         handles    = enumerator.EnumerateWindows(2000);
                if (null == handles || handles.Length == 0)
                {
                    return(new List <object>());
                }

                return(ExcelApplicationWindow.GetApplicationProxiesFromHandle(handles));
            }
            catch (Exception exception)
            {
                DebugConsole.Default.WriteException(exception);
                throw;
            }
        }
Exemplo n.º 3
0
        private static object GetActiveExcelApplicationProxyFromDesktop()
        {
            try
            {
                WindowEnumerator enumerator = new WindowEnumerator("XLMAIN");
                IntPtr[]         handles    = enumerator.EnumerateWindows(2000);
                if (null == handles || handles.Length == 0)
                {
                    return(null);
                }

                object proxy = ExcelApplicationWindow.GetApplicationProxyFromHandle(handles[0]);
                return(proxy);
            }
            catch (Exception exception)
            {
                DebugConsole.Default.WriteException(exception);
                throw;
            }
        }