示例#1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!Directory.Exists("./Plugin"))
            {
                Directory.CreateDirectory("./Plugin");
            }

            ScreenUtility.PrintVisibleWindowHandles(2);

            IntPtr progman = Win32Api.FindWindow("Progman", null);
            IntPtr result  = IntPtr.Zero;

            Win32Api.SendMessageTimeout(progman,
                                        0x052C,
                                        new IntPtr(0),
                                        IntPtr.Zero,
                                        Win32Api.SendMessageTimeoutFlags.SMTO_NORMAL,
                                        1000,
                                        out result);

            ScreenUtility.PrintVisibleWindowHandles(2);

            IntPtr workerw = IntPtr.Zero;

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

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

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

            SettingData.LoadSetting();

            Application.Run(new FormWallpaper(workerw));

            RegistryKey theCurrentMachine = Registry.CurrentUser;
            RegistryKey theControlPanel   = theCurrentMachine.OpenSubKey("Control Panel");
            RegistryKey theDesktop        = theControlPanel.OpenSubKey("Desktop");

            Win32Api.SystemParametersInfo(Win32Api.SPI_SETDESKWALLPAPER, 0, Convert.ToString(theDesktop.GetValue("Wallpaper")), Win32Api.SPIF_UPDATEINIFILE);
        }
示例#2
0
 private void materialRaisedButton2_Click(object sender, EventArgs e)
 {
     SettingData.SaveWallPaperSetting(wallpaper.controls);
     wallpaper.LoadSetting();
 }
示例#3
0
 private void materialRaisedButton3_Click(object sender, EventArgs e)
 {
     SettingData.SavePluginSetting(listBox1.Items.Cast <String>().ToArray());
 }
示例#4
0
 private void materialRaisedButton1_Click(object sender, EventArgs e)
 {
     SettingData.SaveBasicSetting(TextFieldImageLocation.Text);
     wallpaper.LoadSetting();
 }