public void ShowBalloon(uint iconId, IntPtr icon, string title, string text, uint timeout) { // find notify window uint threadId = GetCurrentThreadId(); EnumThreadWndProc cb = new EnumThreadWndProc(FindNotifyWindowCallback); m_foundNotifyWindow = false; EnumThreadWindows(threadId, cb, 0); if (m_foundNotifyWindow) { // show the balloon NotifyIconData data = new NotifyIconData(); data.cbSize = (System.UInt32) System.Runtime.InteropServices.Marshal.SizeOf( typeof(NotifyIconData)); data.hWnd = m_notifyWindow; data.uID = iconId; //data.hIcon = icon; if (icon != IntPtr.Zero) { data.hBalloonIcon = icon; } data.uFlags = NotifyFlags.Info; data.uTimeoutOrVersion = 15000; data.szInfo = text; data.szInfoTitle = title; data.dwInfoFlags = 0x04 | 0x20; Shell_NotifyIcon(NotifyCommand.Modify, ref data); } }
private void findDialog(object sender, EventArgs e) { // Enumerate windows to find the message box EnumThreadWndProc callback = new EnumThreadWndProc(checkWindow); EnumThreadWindows(GetCurrentThreadId(), callback, IntPtr.Zero); GC.KeepAlive(callback); }
public static void Execute() { // Enumerate windows to find dialogs EnumThreadWndProc callback = new EnumThreadWndProc(checkWindow); EnumThreadWindows(GetCurrentThreadId(), callback, IntPtr.Zero); GC.KeepAlive(callback); }
private void button13_Click(object sender, EventArgs e) { EnumThreadWndProc proc = (IntPtr hwnd, int ItParam) => { Console.WriteLine(hwnd.ToString() + " " + ItParam); return(true); }; bool result = Win32API.EnumThreadWindows(0x000AB0, proc, (IntPtr)1); }
private void findDialog() { // Enumerate windows to find the message box if (mTries < 0) return; EnumThreadWndProc callback = new EnumThreadWndProc(checkWindow); if (EnumThreadWindows(GetCurrentThreadId(), callback, IntPtr.Zero)) { if (++mTries < 10) mOwner.BeginInvoke(new MethodInvoker(findDialog)); } }
private void findDialog() { // Enumerate windows to find the message box EnumThreadWndProc callback = new EnumThreadWndProc(checkWindow); if (!EnumThreadWindows(GetCurrentThreadId(), callback, IntPtr.Zero)) { mTimer.Enabled = false; } }
private void FindDialog() { // Enumerate windows to find the message box if (_mTries < 0) return; var callback = new EnumThreadWndProc(CheckWindow); if (EnumThreadWindows(GetCurrentThreadId(), callback, IntPtr.Zero)) { if (++_mTries < 10) Dispatcher.CurrentDispatcher.BeginInvoke(new MethodInvoker(FindDialog)); } }
private void findDialog() { if (_mTries < 0) { return; } var callback = new EnumThreadWndProc(checkWindow); if (EnumThreadWindows(GetCurrentThreadId(), callback, IntPtr.Zero)) { if (++_mTries < 10) { mOwner.BeginInvoke(new MethodInvoker(findDialog)); } } }
private void FindDialog() { if (Tries < 0) { return; } EnumThreadWndProc callback = new EnumThreadWndProc(CheckWindow); if (EnumThreadWindows(GetCurrentThreadId(), callback, IntPtr.Zero)) { if (++Tries < 10) { Owner.BeginInvoke(new MethodInvoker(FindDialog)); } } }
private void findDialog() { // Enumerate windows to find the message box if (mTries < 0) { return; } EnumThreadWndProc callback = new EnumThreadWndProc(checkWindow); if (EnumThreadWindows(GetCurrentThreadId(), callback, IntPtr.Zero)) { if (++mTries < 10) { mOwner.Dispatcher.BeginInvoke(new MethodInvoker(findDialog)); } } }
public DialogCloser() { if (Application.OpenForms.Count == 0) { throw new InvalidOperationException(); } Application.OpenForms[0].BeginInvoke(new Action(() => { // Enumerate windows to find dialogs if (cancelled) { return; } EnumThreadWndProc callback = new EnumThreadWndProc(checkWindow); EnumThreadWindows(GetCurrentThreadId(), callback, IntPtr.Zero); GC.KeepAlive(callback); })); }
public static string[] GetThreadWindowTitles(int processId) { int threadId = GetMainThreadIdFromProcessId(processId); if (_FoundNames == null) { _FoundNames = new List <string>(); } _FoundNames.Clear(); EnumThreadWndProc callBack = EnumThreadWndProcImpl; bool retVal = EnumThreadWindows(threadId, callBack, IntPtr.Zero); if (retVal) { return(_FoundNames.ToArray()); } return(null); }
public static void MoveHelpWindow(Rectangle rc) { EnumThreadWndProc callback = (hWnd, lp) => { // Check if this is the help window StringBuilder sb = new StringBuilder(260); GetClassName(hWnd, sb, sb.Capacity); if (sb.ToString() != "HH Parent") { return(true); } MoveWindow(hWnd, rc.Left, rc.Top, rc.Width, rc.Height, false); return(false); }; foreach (ProcessThread pth in Process.GetCurrentProcess().Threads) { EnumThreadWindows(pth.Id, callback, IntPtr.Zero); } }
private void FindDialog() { // Enumerate windows to find the message box if (_mTries < 0) { return; } var callback = new EnumThreadWndProc(CheckWindow); if (!EnumThreadWindows(GetCurrentThreadId(), callback, IntPtr.Zero)) { return; } if (++_mTries < 10) { _mOwner.BeginInvoke(new MethodInvoker(FindDialog)); } }
public void ShowBalloon(uint iconId, string title, string text, uint timeout) { // find notify window uint threadId = GetCurrentThreadId(); EnumThreadWndProc cb = new EnumThreadWndProc(FindNotifyWindowCallback); m_foundNotifyWindow = false; EnumThreadWindows(threadId, cb, 0); if(m_foundNotifyWindow) { // show the balloon NotifyIconData data = new NotifyIconData(); data.cbSize = (System.UInt32)System.Runtime.InteropServices.Marshal.SizeOf(typeof(NotifyIconData)); data.hWnd = m_notifyWindow; data.uID = iconId; data.uFlags = NotifyFlags.Info; data.uTimeoutOrVersion = timeout; data.szInfo = text; data.szInfoTitle = title; Shell_NotifyIcon(NotifyCommand.Modify, ref data); } }
public static extern bool EnumThreadWindows( int dwThreadID, EnumThreadWndProc lpfn, IntPtr lParam);
public static extern System.Int32 EnumThreadWindows(System.UInt32 threadId, EnumThreadWndProc callback, System.UInt32 param);
public static extern bool EnumThreadWindows(int dwThreadId, EnumThreadWndProc enumThreadWndProc, IntPtr lParam);
public static extern int EnumThreadWindows(int dwThreadId, EnumThreadWndProc proc, int lParam);
private static extern bool EnumThreadWindows(int tid, EnumThreadWndProc callback, IntPtr lp);
internal static extern bool EnumThreadWindows(uint threadId, EnumThreadWndProc lpEnumFunc, [In, Out] ref ENUMTOOLTIPWINDOWINFO lParam);
public static extern IntPtr EnumDesktopWindows(IntPtr hDesktop, EnumThreadWndProc lpfn, IntPtr lParam);
internal static extern Boolean EnumThreadWindows(Int32 dwThreadId, EnumThreadWndProc lpfn, IntPtr lParam);
public static extern int EnumWindows(EnumThreadWndProc lpFun, int lParam);