Exemple #1
0
        private void RefreshAero()
        {   //子菜单很快10毫秒就够
            Thread.Sleep(10);
            //子菜单也只有一个默认类名 没有标题
            IntPtr MenuHandle = Win32Api.FindWindowExA(IntPtr.Zero, IntPtr.Zero, "#32768", string.Empty);

            if (FirstHandle == IntPtr.Zero)
            {
                FirstHandle = MenuHandle;
            }                                                            //初始化
            //菜单的宽高
            Win32Api.RECT rect = new Win32Api.RECT();
            Win32Api.GetClientRect(MenuHandle, ref rect);
            //再小应该就不是菜单了
            if (Previous != MenuHandle && rect.right > 100 && rect.bottom > 20)
            {
                Addtext("New Submenu");
                if (checkBox1.Checked)
                {
                    aero.LoadAero2(MenuHandle);
                }
                else
                {
                    aero.LoadAero1(MenuHandle);
                }
                Addtext("StartAero");
            }
            Previous = MenuHandle;
        }
Exemple #2
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();
        }
Exemple #3
0
 private void judge()
 {   //关闭也很快10毫秒足够
     Thread.Sleep(10);
     Win32Api.RECT rect = new Win32Api.RECT();
     Win32Api.GetClientRect(FirstHandle, ref rect);
     //那就不存在的 都是0
     if (rect.left == 0 && rect.top == 0 && rect.right == 0 && rect.bottom == 0)
     {   //清空,初始化
         FirstHandle = IntPtr.Zero;
     }
 }