コード例 #1
0
        public static IntPtr GetOrCreateBackground()
        {
            if (_workerw == IntPtr.Zero)
            {
                var workerw = IntPtr.Zero;

                EnumWindows((station, param) =>
                {
                    var p = RunningWindows.FindWindowEx(station, IntPtr.Zero, "SHELLDLL_DefView", null);

                    if (p != IntPtr.Zero)
                    {
                        workerw = RunningWindows.FindWindowEx(IntPtr.Zero, station, "WorkerW", null);
                    }
                    return(true);
                }, IntPtr.Zero);

                if (workerw == IntPtr.Zero)
                {
                    var    program = RunningWindows.FindWindow(null, "Program Manager");
                    IntPtr result  = IntPtr.Zero;
                    RunningWindows.SendMessageTimeout(program, 0x052C, new IntPtr(0), IntPtr.Zero, RunningWindows.SendMessageTimeoutFlags.SMTO_NORMAL, 1000, out result);

                    return(GetOrCreateBackground());
                }

                _workerw = workerw;
            }

            return(_workerw);
        }
コード例 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Visible       = false;
            ShowInTaskbar = false;
            WindowState   = FormWindowState.Minimized;
            Hide();

            RunningWindows.GetOrCreateBackground();
        }
コード例 #3
0
        //private Dictionary<IntPtr, InfoWindow> backgroundWindows = new Dictionary<IntPtr, InfoWindow>();

        private void toolStripMenuItem3_DropDownOpening(object sender, EventArgs e)
        {
            var backgroundWindows = RunningWindows.GetBackgroundWindows();

            if (backgroundWindows.Any())
            {
                toolStripMenuItem3.DropDownItems.Clear();

                foreach (var kvp in backgroundWindows)
                {
                    var moveToForeground = new ToolStripButton(kvp.Value.Title);
                    moveToForeground.Click += (o, args) =>
                    {
                        RunningWindows.SetParent(kvp.Key, IntPtr.Zero);
                    };
                    toolStripMenuItem3.DropDownItems.Add(moveToForeground);
                }
            }
        }
コード例 #4
0
        private void toolStripMenuItem2_DropDownOpening(object sender, EventArgs e)
        {
            var windows = RunningWindows.GetOpenedWindows();

            if (windows.Any())
            {
                toolStripMenuItem2.DropDownItems.Clear();

                foreach (var kvp in windows)
                {
                    var moveToBackground = new ToolStripButton(kvp.Value.Title);
                    moveToBackground.Click += (o, args) =>
                    {
                        RunningWindows.SetParent(kvp.Key, RunningWindows.GetOrCreateBackground());
                        //backgroundWindows[kvp.Key] = kvp.Value;
                    };
                    toolStripMenuItem2.DropDownItems.Add(moveToBackground);
                }
            }
        }