Ejemplo n.º 1
0
        public bool GetCurrentWordDocs(out List <string> docs)
        {
            docs = new List <string>();
            Microsoft.Office.Interop.Word.Application WordObj = null;
            try
            {
                WordObj = (Microsoft.Office.Interop.Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
                for (int i = 0; i < WordObj.Windows.Count; i++)
                {
                    object idx = i + 1;
                    Microsoft.Office.Interop.Word.Window WinObj = WordObj.Windows.get_Item(ref idx);
                    docs.Add(WinObj.Document.FullName);
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                if (WordObj != null)
                {
                    Marshal.ReleaseComObject(WordObj);
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
 // 窗口尺寸、位置变化事件
 private void Application_WindowSize(Microsoft.Office.Interop.Word.Document Doc, Microsoft.Office.Interop.Word.Window Wn)
 {
     // 匹配自己所属的文档
     if (Globals.ThisAddIn.Application.ActiveDocument.FullName == _propDocumentFullName)
     {
         if (Wn.WindowState == Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateMinimize)
         {
             this.Hide();
         }
         else
         {
             this.Show();
             //this.TopMost = Globals.ThisAddIn.Application.ActiveDocument.FullName == _propDocumentFullName ? true : false;
             SetLocation();
         }
     }
     UpdateDisplay();
 }
Ejemplo n.º 3
0
 void _WordApplication_WindowDeactivate(Microsoft.Office.Interop.Word.Document Doc, Microsoft.Office.Interop.Word.Window Wn)
 {
     DisplayInWatchWindow(countWindowDeactivate++, System.Reflection.MethodInfo.GetCurrentMethod().Name);
 }
Ejemplo n.º 4
0
 private void Application_WindowDeactivate(Microsoft.Office.Interop.Word.Document Doc, Microsoft.Office.Interop.Word.Window Wn)
 {
     // Word程序失去焦点,比如切换到其它程序时,将该窗口的置顶取消。
     // this.TopMost = false;
 }
        void WordApplicationWindowActivate(Microsoft.Office.Interop.Word.Document Doc, Microsoft.Office.Interop.Word.Window Wn)
        {
            if (m_isDocumentClosed)
            {
                return;
            }

            if (!Doc.Equals(m_verifier.Document))
            {
                return;
            }


            // if the word window gets activated and the verifier window is also active,
            // then make the verifier window deactive
            // this happens when switching between windows with alt+tab or other pop-up windows
            if (!m_isContentDeactivated)
            {
                DeactivateContent();
            }
        }