/// <summary> /// Called by the constructor to start watching popups /// on a separate thread. /// </summary> private void Start() { while (keepRunning) { Process process = getProcess(ProcessId); if (process != null) { foreach (ProcessThread t in process.Threads) { int threadId = t.Id; NativeMethods.EnumThreadProc callbackProc = new NativeMethods.EnumThreadProc(myEnumThreadWindowsProc); NativeMethods.EnumThreadWindows(threadId, callbackProc, IntPtr.Zero); } // Keep DialogWatcher responsive during 1 second sleep period int count = 0; while (keepRunning && count < 5) { Thread.Sleep(200); count++; } } else { keepRunning = false; } } }
public PopupDialogCollection(Process infoPathProcess) { popupDialogs = new ArrayList(); IntPtr hWnd = IntPtr.Zero; foreach (ProcessThread t in infoPathProcess.Threads) { int threadId = t.Id; NativeMethods.EnumThreadProc callbackProc = new NativeMethods.EnumThreadProc(EnumChildForTridentDialogFrame); NativeMethods.EnumThreadWindows(threadId, callbackProc, hWnd); } }
public HtmlDialogCollection(Process ieProcess, bool waitForComplete) { _waitForComplete = waitForComplete; htmlDialogs = new ArrayList(); IntPtr hWnd = IntPtr.Zero; foreach (ProcessThread t in ieProcess.Threads) { int threadId = t.Id; NativeMethods.EnumThreadProc callbackProc = new NativeMethods.EnumThreadProc(EnumChildForTridentDialogFrame); NativeMethods.EnumThreadWindows(threadId, callbackProc, hWnd); } }
/// <summary> /// Called by the constructor to start watching popups /// on a separate thread. /// </summary> private void Start() { while (keepRunning) { Process process = getProcess(ProcessId); if (process != null) { foreach (ProcessThread t in process.Threads) { if (!keepRunning) return; int threadId = t.Id; NativeMethods.EnumThreadProc callbackProc = new NativeMethods.EnumThreadProc(myEnumThreadWindowsProc); NativeMethods.EnumThreadWindows(threadId, callbackProc, IntPtr.Zero); } // Keep DialogWatcher responsive during 1 second sleep period int count = 0; while (keepRunning && count < 5) { Thread.Sleep(200); count++; } } else { keepRunning = false; } } }