Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In Application tab in Windows Task Manager you see the list of windows opened in the system, but there is only one process (1 application) wich onws the 2 windows.</p> <p>This code is for search a window in the system. Maybe is useful for you because you can search by "New Customer" title or maybe it's a good start for your future research.</p> <pre><code>using System.Runtime.InteropServices; using System.Text; public class WndSearcher { public static IntPtr SearchForWindow(string wndclass, string title) { SearchData sd = new SearchData { Wndclass=wndclass, Title=title }; EnumWindows(new EnumWindowsProc(EnumProc), ref sd); return sd.hWnd; } public static bool EnumProc(IntPtr hWnd, ref SearchData data) { // Check classname and title // This is different from FindWindow() in that the code below allows partial matches StringBuilder sb = new StringBuilder(1024); GetClassName(hWnd, sb, sb.Capacity); if (sb.ToString().StartsWith(data.Wndclass)) { sb = new StringBuilder(1024); GetWindowText(hWnd, sb, sb.Capacity); if (sb.ToString().StartsWith(data.Title)) { data.hWnd = hWnd; return false; // Found the wnd, halt enumeration } } return true; } public class SearchData { // You can put any dicks or Doms in here... public string Wndclass; public string Title; public IntPtr hWnd; } private delegate bool EnumWindowsProc(IntPtr hWnd, ref SearchData data); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, ref SearchData data); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] public static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount); } </code></pre> <p>Then you'd call:</p> <pre><code>// If you're viewing this page with IE, this *should* return the hwnd of the browser IntPtr hWnd = WndSearcher.SearchForWindow("IEFrame", "pinvoke.net: EnumWindows"); </code></pre> <p>Code from <a href="http://www.pinvoke.net/default.aspx/user32/EnumWindows.html" rel="nofollow">pinvoke.net</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload