public static bool HasInDesignAppWindow()
        {
            IntPtr ptrIndd = IntPtr.Zero;

            ptrIndd = Win32Pinvoker.FindWindow(INDD_APP_CLASSNAME,
                                               INDD_APP_WINDOW_TITLE);
            if (ptrIndd != IntPtr.Zero)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// Check the pop up dialog of InDesign Application when exporting,
        /// and close it automactically to make sure the process of exporting
        /// will not be blocked.
        /// </summary>
        private void CheckPopupDialog()
        {
            while (isInddappBlocked)
            {
                IntPtr hwnd = Win32Pinvoker.FindWindow(
                    INDD_POPUP_DIALOG_CLASSNAME,
                    INDD_POPUP_DIALOG_TITLE);

                if (hwnd == IntPtr.Zero)
                {
                    // sleep a short time because the procedure of exporting
                    // maybe need a while.
                    Thread.Sleep(100);
                }
                else
                {
                    Win32Pinvoker.ClosePopupDialog(hwnd);
                }
            }
        }