Пример #1
0
        //WindowのStyleがPopupならtrueを返す
        private bool IsPopupWindowWindow(IntPtr hWnd)
        {
            API.WINDOWINFO wi    = GetWindowInfo(hWnd);
            uint           flag  = (uint)API.WINDOW_STYLE.WS_POPUPWINDOW;
            var            style = wi.dwStyle & flag;

            return(style == flag);
        }
Пример #2
0
        //WindowのStyleがPopupならtrueを返す
        private bool IsAnyStyleWindow(IntPtr hWnd, API.WINDOW_STYLE wStyle)
        {
            API.WINDOWINFO wi     = GetWindowInfo(hWnd);
            uint           uStyle = (uint)wStyle;
            var            style  = wi.dwStyle & uStyle;

            return(style == uStyle);
        }
Пример #3
0
        //WindowのStyleがPopupならtrueを返す
        private bool IsPopupWindow(IntPtr hWnd)
        {
            API.WINDOWINFO wi    = GetWindowInfo(hWnd);
            uint           pop   = (uint)API.WINDOW_STYLE.WS_POPUP;
            var            style = wi.dwStyle & pop;

            return(style == pop);
        }
Пример #4
0
        private void Test1()
        {
            //MessageBox.Show("ホットキーーーーーーーーーーーー");
            IntPtr foreWnd   = API.GetForegroundWindow();
            var    parentWnd = API.GetParent(foreWnd);
            var    owner     = API.GetWindow(foreWnd, API.GETWINDOW_CMD.GW_OWNER);

            var tstr                   = GetOwnerWidndowWithText();
            var tstr2                  = GetOwnerWidndowWithText(foreWnd);
            var foreのOwnerのChild       = GetWindowEx(tstr2.Item1, API.GETWINDOW_CMD.GW_CHILD);
            var ForeのOwnerのPopup       = GetWindowEx(tstr2.Item1, API.GETWINDOW_CMD.GW_ENABLEDPOPUP);
            var ForeのOwner             = GetWindowEx(foreWnd, API.GETWINDOW_CMD.GW_OWNER);
            var ForeのOwnerのOwner       = GetWindowEx(ForeのOwner.Item1, API.GETWINDOW_CMD.GW_OWNER);
            var ForeのOwnerのPopupのOwner = GetWindowEx(ForeのOwnerのPopup.Item1, API.GETWINDOW_CMD.GW_OWNER);
            var ForeのPopup             = GetWindowEx(foreWnd, API.GETWINDOW_CMD.GW_ENABLEDPOPUP);

            var activePop = API.GetLastActivePopup(foreWnd);//常にForegroundWindowになる
            var foreInfo  = GetWindowInfo(foreWnd);
            var ispop     = IsPopupWindow(foreWnd);

            var npw  = GetNextPopUpWindows(foreWnd);
            var npwo = GetNextPopUpWindows2(foreWnd);
            var ppwo = GetPrevPopUpWindows2(foreWnd);


            string title1        = GetWindowTitle(foreWnd);
            var    foreCMDRects  = GetCMDRects(foreWnd);
            var    foreNextRects = GetNextWindowTextAndRects(foreWnd);
            var    forePrevRects = GetPrevWindowTextAndRects(foreWnd);
            var    wInfo         = new API.WINDOWINFO();

            wInfo.cbSize = Marshal.SizeOf(wInfo);
            API.GetWindowInfo(foreWnd, ref wInfo);
            var f = Convert.ToString(wInfo.dwStyle, 2);
            var g = Convert.ToString(wInfo.dwStyle, 16);
            var h = wInfo.dwStyle & 0x8000_0000;
            var i = h == 0x8000_0000;
            var j = Convert.ToString(h, 16);

            (string, IntPtr)pp     = GetParentWithTitle(foreWnd);
            (string, IntPtr ioo)oo = GetOwnerWithTitle(foreWnd);
            //var gp = GetPopupWindows(oo.ioo);
            var    gpt    = GetPopupToTaitleWindow(API.GetWindow(foreWnd, API.GETWINDOW_CMD.GW_ENABLEDPOPUP));
            var    gptp   = GetPopupToParentTaitleWindow(API.GetWindow(foreWnd, API.GETWINDOW_CMD.GW_ENABLEDPOPUP));
            string title2 = GetWindowTitle(foreWnd);

            var parentCMDRects  = GetCMDRects(parentWnd);
            var parentNextRects = GetNextWindowTextAndRects(parentWnd);
            var parentPrevRects = GetPrevWindowTextAndRects(parentWnd);

            var ownCMDRects  = GetCMDRects(owner);
            var ownNextRects = GetNextWindowTextAndRects(owner);
            var ownPrevRects = GetPrevWindowTextAndRects(owner);

            _ = API.GetWindowRect(foreWnd, out API.RECT fRe);
            _ = API.GetWindowRect(parentWnd, out API.RECT pRe);
            _ = API.GetWindowRect(owner, out API.RECT oRe);

            var foreChildWnd       = API.GetWindow(foreWnd, API.GETWINDOW_CMD.GW_CHILD);
            var foreChildCMDRects  = GetCMDRects(foreChildWnd);
            var foreChildsNextRect = GetNextWindowTextAndRects(foreChildWnd);
            var foreChildsPrevRect = GetPrevWindowTextAndRects(foreChildWnd);

            var parentChild          = API.GetWindow(parentWnd, API.GETWINDOW_CMD.GW_CHILD);
            var parentChildCMDRects  = GetCMDRects(parentChild);
            var parentChildsNextRect = GetNextWindowTextAndRects(parentChild);
            var parentChildsPrevRect = GetPrevWindowTextAndRects(parentChild);

            var ownChild              = API.GetWindow(owner, API.GETWINDOW_CMD.GW_CHILD);
            var ownChildCMDRects      = GetCMDRects(ownChild);
            var ownChildsNextRect     = GetNextWindowTextAndRects(ownChild);
            var ownPrevChildsNextRect = GetPrevWindowTextAndRects(ownChild);

            API.GetWindowRect(foreWnd, out API.RECT foreRect);
            API.GetWindowRect(parentWnd, out API.RECT PareRect);
            API.GetWindowRect(foreChildWnd, out API.RECT ChildRect);
            API.GetWindowRect(owner, out API.RECT OwnerRect);
            API.GetWindowRect(API.GetWindow(foreWnd, API.GETWINDOW_CMD.GW_ENABLEDPOPUP), out API.RECT popupRect);
            API.GetWindowRect(API.GetWindow(parentWnd, API.GETWINDOW_CMD.GW_ENABLEDPOPUP), out API.RECT popupRectParent);
            API.GetWindowRect(API.GetWindow(foreChildWnd, API.GETWINDOW_CMD.GW_ENABLEDPOPUP), out API.RECT popupRectChild);
            API.GetWindowRect(API.GetWindow(owner, API.GETWINDOW_CMD.GW_ENABLEDPOPUP), out API.RECT popupRectOwner);


            //var textFore = new StringBuilder(65535);
            //API.GetWindowText(foreWnd, textFore, 65535);

            //var stb = new StringBuilder(65535);
            //int wndText = API.GetWindowText(parentWnd, stb, 65535);
        }