Пример #1
0
        void wh_OnMessageHook(object sender, MessageHookEventArgs e)
        {
            switch (e.msg)
            {
                // A window has been hidden / visible
                case StandardMessages.WM_SHOWWINDOW:
                    string txt = Win32.GetText((int)e.hwnd).ToLower();

                    if (txt.Length == 0)
                        return;

                    ChildWindow child = new ChildWindow((int)e.hwnd);

                    if ((txt.StartsWith("raise") || txt.StartsWith("bet") || txt.StartsWith("all") || txt.StartsWith("fold") || txt.StartsWith("wait") || txt.StartsWith("call") || txt.StartsWith("check") || txt.StartsWith("post") || txt.StartsWith("sit out")) && !txt.Contains("respond"))
                    {
                        if (child.SizeRatio < 4)
                        {
                            if (Convert.ToBoolean(e.wp) && !needsAction)
                            {
                                // Requires action
                                needsAction = true;
                                OnRequiresAction();
                                ForceRedraw();
                            }
                            else if (needsAction && !Convert.ToBoolean(e.wp))
                            {
                                // No longer requires action
                                needsAction = false;
                                OnNoLongerRequiresAction();
                            }
                        }
                    }
                    else if (txt.StartsWith("i am back") && child.SizeRatio < 4)
                    {
                        if (Convert.ToBoolean(e.wp) && !isSittingOut)
                        {
                            // Sitting out
                            isSittingOut = true;
                            OnSittingOut();
                        }
                        else if (isSittingOut && !Convert.ToBoolean(e.wp))
                        {
                            // Sitting in
                            isSittingOut = false;
                            OnSittingIn();
                        }
                    }
                    else if (txt.StartsWith("Deal Me Out"))
                    {
                        if (Convert.ToBoolean(e.wp) && !isSeated)
                        {
                            // Seated
                            isSeated = true;
                            OnSeated();
                        }
                        else if (isSeated && !Convert.ToBoolean(e.wp))
                        {
                            // Unseated
                            isSeated = false;
                            OnUnSeated();
                        }
                    }
                    break;
            }
        }
Пример #2
0
        public override bool EnumChildWindowCallBack(int hWnd, int lParam)
        {
            if (children.ContainsKey(hWnd) || bannedChildren.Contains(hWnd))
                return true;

            ChildWindow cw = new ChildWindow(hWnd);

            // Only save this child if it's relevant, otherwise ban the window
            if (cw.ControlID == 339 || cw.ControlID == 443 || cw.ControlID == 4000)
                children.Add(hWnd, new ChildWindow(hWnd));
            else
                bannedChildren.Add(hWnd);

            return true;
        }