Exemple #1
0
            public void FindWindows(int parentHandle, Regex className, Regex windowText, Regex process, FoundWindowCallback fwc)
            {
                this.parentHandle = parentHandle;
                this.className    = className;
                this.windowText   = windowText;
                this.process      = process;

                foundWindow = fwc;

                EnumChildWindows(parentHandle, new PChildCallBack(EnumChildWindowsCallback), 0);
            }
Exemple #2
0
        // The main search function of the WindowFinder class. The parentHandle parameter is optional, taking in a zero if omitted.
        // The className can be null as well, in this case the class name will not be searched. For the window text we can input
        // a Regex object that will be matched to the window text, unless it's null. The process parameter can be null as well,
        // otherwise it'll match on the process name (Internet Explorer = "iexplore"). Finally we take the FoundWindowCallback
        // function that'll be called each time a suitable window has been found.
        public void FindWindows(int parentHandle, Regex className, Regex windowText, Regex process, FoundWindowCallback fwc)
        {
            _className  = className;
            _windowText = windowText;
            _process    = process;

            // Add the FounWindowCallback to the foundWindow event.
            FoundWindow = fwc;

            // Invoke the EnumChildWindows function.
            EnumChildWindows(parentHandle, EnumChildWindowsCallback, 0);
        }
    // The main search function of the WindowFinder class. The parentHandle parameter is optional, taking in a zero if omitted.
    // The className can be null as well, in this case the class name will not be searched. For the window text we can input
    // a Regex object that will be matched to the window text, unless it's null. The process parameter can be null as well,
    // otherwise it'll match on the process name (Internet Explorer = "iexplore"). Finally we take the FoundWindowCallback
    // function that'll be called each time a suitable window has been found.
    public void FindWindows(IntPtr parentHandle, Regex className, Regex windowText, Regex process, FoundWindowCallback fwc)
    {
        this.parentHandle = parentHandle;
        this.className    = className;
        this.windowText   = windowText;
        this.process      = process;

        // Add the FounWindowCallback to the foundWindow event.
        foundWindow = fwc;

        // Invoke the EnumChildWindows function.
        User32.EnumChildWindows(parentHandle, new User32.PChildCallBack(enumChildWindowsCallback), 0);
    }