Show window in Qt without stealing focus
It took me a while to find it but I found it: setAttribute(Qt::WA_ShowWithoutActivating); This forces the window not to activate. Even with the Qt::WindowStaysOnTopHint flag
It took me a while to find it but I found it: setAttribute(Qt::WA_ShowWithoutActivating); This forces the window not to activate. Even with the Qt::WindowStaysOnTopHint flag
On windows, you can use the python for windows extensions (http://sourceforge.net/projects/pywin32/): from win32gui import GetWindowText, GetForegroundWindow print GetWindowText(GetForegroundWindow()) Below code is for python 3: from win32gui import GetWindowText, GetForegroundWindow print(GetWindowText(GetForegroundWindow())) (Found this on http://scott.sherrillmix.com/blog/programmer/active-window-logger/)
Rectangle bounds = Screen.GetBounds(Point.Empty); using(Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height)) { using(Graphics g = Graphics.FromImage(bitmap)) { g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size); } bitmap.Save(“test.jpg”, ImageFormat.Jpeg); } for capturing current window use Rectangle bounds = this.Bounds; using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height)) { using (Graphics g = Graphics.FromImage(bitmap)) { g.CopyFromScreen(new Point(bounds.Left,bounds.Top), Point.Empty, bounds.Size); } bitmap.Save(“C://test.jpg”, ImageFormat.Jpeg); }