public void Pause() { IntPtr flash = this.PlayerHandle; if (flash != IntPtr.Zero) { IntPtr result = IntPtr.Zero; // 첫번째 클릭에서 포커스를 잠깐 얻고 // 두번째 클릭에서 실제로 클릭이 처리되게 하게끔 함. // TODO: 아래 방법은 개선되어야 함. for (int step = 0; step < 2; ++step) { WinApi.SendMessageTimeout(flash, 0x201 /*DOWN*/, new IntPtr(1), new IntPtr(WinApi.MakeParam(500, 1000)), WinApi.SendMessageTimeoutFlags.SMTO_NORMAL, 0, out result); //WinApi.SendMessageTimeout(flash, 0x202/*UP*/, new IntPtr(1), new IntPtr(WinApi.MakeParam(500, 1000)), // WinApi.SendMessageTimeoutFlags.SMTO_NORMAL, 0, out result); } } }
public void PerformClickWallpaper(int x, int y) { IntPtr flash = this.PlayerHandle; if (flash != IntPtr.Zero) { IntPtr result = IntPtr.Zero; // 첫번째 이벤트에서 포커스를 잠깐 얻고 WinApi.SendMessageTimeout(flash, 0x202 /*UP*/, new IntPtr(1), new IntPtr(WinApi.MakeParam(y, x)), WinApi.SendMessageTimeoutFlags.SMTO_NORMAL, 0, out result); // 두번째 클릭에서 실제로 클릭이 처리되게 하게끔 함. WinApi.SendMessageTimeout(flash, 0x201 /*DOWN*/, new IntPtr(1), new IntPtr(WinApi.MakeParam(y, x)), WinApi.SendMessageTimeoutFlags.SMTO_NORMAL, 0, out result); WinApi.SendMessageTimeout(flash, 0x202 /*UP*/, new IntPtr(1), new IntPtr(WinApi.MakeParam(y, x)), WinApi.SendMessageTimeoutFlags.SMTO_NORMAL, 0, out result); } }
public static bool FixBehindDesktopIcon(IntPtr formHandle) { IntPtr progman = WinApi.FindWindow("Progman", null); if (progman == IntPtr.Zero) { return(false); } IntPtr workerw = IntPtr.Zero; // 여러번 시도함. for (int step = 0; step < 8; ++step) { // 한번씩은 건너뜀. if (step % 2 == 0) { IntPtr result = IntPtr.Zero; WinApi.SendMessageTimeout(progman, 0x052C, new IntPtr(0), IntPtr.Zero, WinApi.SendMessageTimeoutFlags.SMTO_NORMAL, 10000, out result); } WinApi.EnumWindows(new WinApi.EnumWindowsProc((tophandle, topparamhandle) => { IntPtr p = WinApi.FindWindowEx(tophandle, IntPtr.Zero, "SHELLDLL_DefView", IntPtr.Zero); if (p != IntPtr.Zero) { workerw = WinApi.FindWindowEx(IntPtr.Zero, tophandle, "WorkerW", IntPtr.Zero); } return(true); }), IntPtr.Zero); if (workerw == IntPtr.Zero) { Thread.Sleep(1000); } else { break; } } if (workerw == IntPtr.Zero) { return(false); } WinApi.ShowWindow(workerw, 0 /*HIDE*/); WinApi.SetParent(formHandle, progman); return(true); }