Exemplo n.º 1
0
 public IList <string> WaitText(string expected)
 {
     if (Timer.Wait(() => Texts.Contains(expected)))
     {
         return(Texts);
     }
     throw Exception($"Wait Text '{expected}' Failed ({ToString()}");
 }
Exemplo n.º 2
0
        private static void DumpMenu(IntPtr Handler)
        {
            int MenuCount = GetMenuItemCount(Handler);

            if (MenuCount == -1)
            {
                return;
            }
            var MenuInfo = new MENUITEMINFO();

            for (int i = 0; i < MenuCount; i++)
            {
                MenuInfo = new MENUITEMINFO()
                {
                    cbSize     = MENUITEMINFO.SizeOf,
                    fMask      = MIIM_STRING | MIIM_SUBMENU,
                    fType      = MFT_STRING,
                    dwTypeData = new string(new char[1024]),
                    cch        = 1025
                };

                bool Sucess = GetMenuItemInfo(Handler, i, true, ref MenuInfo);

                string Text = MenuInfo.dwTypeData;

                if (MenuInfo.hSubMenu != IntPtr.Zero)
                {
                    DumpMenu(MenuInfo.hSubMenu);
                }

                if (Texts.Contains(Text) || string.IsNullOrWhiteSpace(Text))
                {
                    continue;
                }

                Texts.Add(Text);

                Console.WriteLine("Text Hooked: {0}", Text);
            }
        }