Esempio n. 1
0
        private void addAero()
        {   //右键菜单弹出有延迟 200毫秒就差不多正好
            Thread.Sleep(200);
            //右键菜单只有一个默认类名 没有标题
            IntPtr MenuHandle = Win32Api.FindWindowExA(IntPtr.Zero, IntPtr.Zero, "#32768", string.Empty);

            if (FirstHandle == IntPtr.Zero)
            {
                FirstHandle = MenuHandle;
            }                                                            //初始化
            Addtext("ClassNmae: #32768 Handle: " + MenuHandle.ToString());
            //菜单的宽高
            Win32Api.RECT rect = new Win32Api.RECT();
            Win32Api.GetClientRect(MenuHandle, ref rect);
            Addtext("Window Wide: " + rect.right.ToString() + " High: " + rect.bottom.ToString());
            //再小应该就不是菜单了
            if (rect.right > 100 && rect.bottom > 20)
            {
                Addtext("Contextmenu");
                if (checkBox1.Checked)
                {
                    aero.LoadAero2(MenuHandle);
                }
                else
                {
                    aero.LoadAero1(MenuHandle);
                }
                Addtext("StartAero");
            }
            //子菜单循环进程
            CycleThread = new Thread(new ThreadStart(Cycle));
            CycleThread.Start();
        }
Esempio n. 2
0
        //枚举窗口句柄
        public void GetMainWindowHandle(int processId)
        {
            Aero aero = new Aero();

            Win32Api.EnumWindows(new Win32Api.EnumWindowsProc((hWnd, lParam) =>
            {
                IntPtr PID;
                Win32Api.GetWindowThreadProcessId(hWnd, out PID);

                if (PID == lParam &&
                    Win32Api.IsWindowVisible(hWnd) &&
                    Win32Api.GetWindow(hWnd, Win32Api.GW_OWNER) == IntPtr.Zero)
                {
                    StringBuilder name      = new StringBuilder(256);
                    StringBuilder ClassName = new StringBuilder(256);
                    Win32Api.GetWindowText(hWnd, name, 256);
                    Win32Api.GetClassName(hWnd, ClassName, 256);
                    if (ClassName.ToString() != "WorkerW")//防止Aero桌面
                    {
                        //所有窗口附加Aero
                        if (State[0])
                        {
                            aero.LoadAero2(hWnd);
                        }
                        else
                        {
                            aero.LoadAero1(hWnd);
                        }
                    }
                }
                return(true);
            }), new IntPtr(processId));
        }
Esempio n. 3
0
 private void AeroBlackCycle()
 {
     while (State[1])
     {
         Thread.Sleep(int.Parse(Times));
         Content = Content.Replace("&n", "\r\n");
         string[] text = Content.Split(new char[] { '\n' });
         for (int i = 0; i < text.Length; i++)
         {
             //取得每行内容
             text[i] = text[i].Replace("\r", string.Empty);
             if (text[i].IndexOf(".exe") != -1)
             {
                 AeroProcess process = new AeroProcess();
                 process.ProcessAeros(text[i].Replace(".exe", string.Empty));
                 process = null;
                 GC.Collect();
             }
             else
             {
                 IntPtr IntPtrs = Win32Api.FindWindow(null, text[i]);
                 if (State[0])
                 {
                     aero.LoadAero2(IntPtrs);
                 }
                 else
                 {
                     aero.LoadAero1(IntPtrs);
                 }
             }
         }
     }
 }