Exemplo n.º 1
0
        /// <summary>
        /// Gets the IntPtr for Worker, correcting for misalignment.
        /// </summary>
        /// <returns></returns>
        private IntPtr GetWorkerw()
        {
            // We enumerate all Windows, until we find one, that has the SHELLDLL_DefView
            // as a child.
            // If we found that window, we take its next sibling and assign it to workerw.
            IntPtr workerw = IntPtr.Zero;

            WinLib.EnumWindows(new WinLib.EnumWindowsProc((tophandle, topparamhandle) =>
            {
                IntPtr p = WinLib.FindWindowEx(tophandle,
                                               IntPtr.Zero,
                                               "SHELLDLL_DefView",
                                               IntPtr.Zero);

                if (p != IntPtr.Zero)
                {
                    // Gets the WorkerW Window after the current one.
                    workerw = WinLib.FindWindowEx(IntPtr.Zero,
                                                  tophandle,
                                                  "WorkerW",
                                                  IntPtr.Zero);
                }

                return(true);
            }), IntPtr.Zero);
            return(workerw);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Spawns the workerw child using the undocumented 0x052C command.
        /// </summary>
        /// <returns></returns>
        private IntPtr SpawnWorkerw()
        {
            IntPtr progman = WinLib.FindWindow("Progman", null);
            IntPtr result  = IntPtr.Zero;

            // Sending 0x052C to progman will spawn the workerw process if it is not already present.
            WinLib.SendMessageTimeout(progman,
                                      0x052C,
                                      new IntPtr(0),
                                      IntPtr.Zero,
                                      WinLib.SendMessageTimeoutFlags.SMTO_NORMAL,
                                      500, // *Lowered value
                                      out result);
            return(result);
        }
Exemplo n.º 3
0
 private void Loadin(IntPtr workerw, Form form)
 {
     WinLib.SetParent(form.Handle, workerw);
 }