internal static IntPtr GetWorkerW()
        {
            _progman = User32Wrapper.FindWindow("Progman", null);
            User32Wrapper.SendMessageTimeout(_progman,
                                             0x052C,
                                             new IntPtr(0),
                                             IntPtr.Zero,
                                             SendMessageTimeoutFlags.SMTO_NORMAL,
                                             1000,
                                             out IntPtr unusefulResult);
            var enumWindowResult = User32Wrapper.EnumWindows(new EnumWindowsProc((tophandle, topparamhandle) =>
            {
                IntPtr shelldll_defview = User32Wrapper.FindWindowEx(tophandle,
                                                                     IntPtr.Zero,
                                                                     "SHELLDLL_DefView",
                                                                     IntPtr.Zero);
                if (shelldll_defview != IntPtr.Zero)
                {
                    _workerw = User32Wrapper.FindWindowEx(IntPtr.Zero,
                                                          tophandle,
                                                          "WorkerW",
                                                          IntPtr.Zero);

                    _desktopWorkerw = tophandle;
                    return(false);
                }

                return(true);
            }), IntPtr.Zero);

            return(_workerw);
        }
Example #2
0
        public static IntPtr GetWorkerW()
        {
            IntPtr progman = User32Wrapper.FindWindow("Progman", null);

            User32Wrapper.SendMessageTimeout(progman,
                                             0x052C,
                                             new IntPtr(0),
                                             IntPtr.Zero,
                                             SendMessageTimeoutFlags.SMTO_NORMAL,
                                             1000,
                                             out IntPtr unusefulResult);
            IntPtr workerw          = IntPtr.Zero;
            var    enumWindowResult = User32Wrapper.EnumWindows(new EnumWindowsProc((tophandle, topparamhandle) =>
            {
                IntPtr p = User32Wrapper.FindWindowEx(tophandle,
                                                      IntPtr.Zero,
                                                      "SHELLDLL_DefView",
                                                      IntPtr.Zero);

                if (p != IntPtr.Zero)
                {
                    workerw = User32Wrapper.FindWindowEx(IntPtr.Zero,
                                                         tophandle,
                                                         "WorkerW",
                                                         IntPtr.Zero);
                    return(false);
                }

                return(true);
            }), IntPtr.Zero);

            return(workerw);
        }
Example #3
0
        private static bool Initlize()
        {
            _showed = false;
            IntPtr progman = User32Wrapper.FindWindow("Progman", null);
            IntPtr result  = IntPtr.Zero;

            User32Wrapper.SendMessageTimeout(progman,
                                             0x052C,
                                             new IntPtr(0),
                                             IntPtr.Zero,
                                             SendMessageTimeoutFlags.SMTO_NORMAL,
                                             1000,
                                             out result);
            _workerw = IntPtr.Zero;
            var result1 = User32Wrapper.EnumWindows(new EnumWindowsProc((tophandle, topparamhandle) =>
            {
                IntPtr p = User32Wrapper.FindWindowEx(tophandle,
                                                      IntPtr.Zero,
                                                      "SHELLDLL_DefView",
                                                      IntPtr.Zero);

                if (p != IntPtr.Zero)
                {
                    _workerw = User32Wrapper.FindWindowEx(IntPtr.Zero,
                                                          tophandle,
                                                          "WorkerW",
                                                          IntPtr.Zero);
                }

                return(true);
            }), IntPtr.Zero);

            _initlized = result1;
            return(result1);
        }