private bool IsNewBorderlessWindow(IntPtr hWnd) { //Check if the window has enlarged its client region to its whole window region, with a //as described here: https://github.com/rossy/borderless-window (used by Visual Stutio, Visual Studio Code, ...) WinAPI.GetClientRect(hWnd, out WinAPI.RectInter _rClient); Rectangle rClient = (Rectangle)_rClient; WinAPI.GetWindowRect(hWnd, out WinAPI.RectInter _rWindow); Rectangle rWindow = (Rectangle)_rWindow; return((rClient.Width == rWindow.Width) && (rClient.Height == rWindow.Height)); }
public void ChangeMoveOrSize(IntPtr hWnd) { if (phase == Phase.StartMoveOrSize) { WinAPI.GetWindowRect(hWnd, out WinAPI.RectInter rWnd); if (((Rectangle)rWnd).Size == wndStartPos.Size) { phase = Phase.Moving; movingWnd = hWnd; beginMoving(hWnd); } //else phase = Phase.Sizing; <-- Does not work well in some cases. Certainly some special windows can quickly change their size before restoring it and begining to move. } else if (phase == Phase.Moving) { if (movingWnd == hWnd) //Really usefull for some cases. { continueMoving(hWnd); } } }