active-window

Determine Whether Program is the Active Window in .NET

泄露秘密 提交于 2019-11-28 13:59:32
I have a C#/.NET app and I want to implement the following behavior: I have a popup menu. Whenever the user clicks on anything within the application that is not the popup menu, I want the popup menu to close. However, whenever a user is not in the application I don't want anything to happen. I'm trying to manage this through the LostFocus event, but I'm having trouble determining whether my application is the active window. The code looks something like this. private void Button_LostFocus(object sender, System.EventArgs e) { if (InActiveWindow()) { CloseMenu() } else { // not in active window

Determine Whether Program is the Active Window in .NET

南楼画角 提交于 2019-11-27 08:21:17
问题 I have a C#/.NET app and I want to implement the following behavior: I have a popup menu. Whenever the user clicks on anything within the application that is not the popup menu, I want the popup menu to close. However, whenever a user is not in the application I don't want anything to happen. I'm trying to manage this through the LostFocus event, but I'm having trouble determining whether my application is the active window. The code looks something like this. private void Button_LostFocus

Get current active window's title in Java

二次信任 提交于 2019-11-27 01:25:17
问题 I am trying to write a Java program that logs what application I'm using every 5 seconds (this is a time tracker app). I need some way to find out what the current active window is. I found KeyboardFocusManager.getGlobalActiveWindow() but I can't get it to work right. A cross platform solution is preferable, but if one doesn't exist, then I'm developing for linux with X.Org. Thanks. 回答1: I'm quite certain that you'll find there's no way to enumerate the active windows in pure Java (I've

Obtain Active window using Python

邮差的信 提交于 2019-11-26 16:26:57
I would like to get the active window on the screen using python. For example, the management interface of the router where you enter the username and password as admin That admin interface is what I want to capture using python to automate the entry of username and password. What imports would I require in order to do this? William Saunders 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

Obtain Active window using Python

╄→гoц情女王★ 提交于 2019-11-26 04:24:16
问题 I would like to get the active window on the screen using python. For example, the management interface of the router where you enter the username and password as admin That admin interface is what I want to capture using python to automate the entry of username and password. What imports would I require in order to do this? 回答1: On windows, you can use the python for windows extensions (http://sourceforge.net/projects/pywin32/): from win32gui import GetWindowText, GetForegroundWindow print

Capture screenshot of active window?

我只是一个虾纸丫 提交于 2019-11-25 22:58:21
问题 I am making a screen capturing application and everything is going fine. All I need to do is capture the active window and take a screenshot of this active window. Does anyone know how I can do this? 回答1: ScreenCapture sc = new ScreenCapture(); // capture entire screen, and save it to a file Image img = sc.CaptureScreen(); // display image in a Picture control named imageDisplay this.imageDisplay.Image = img; // capture this window, and save it sc.CaptureWindowToFile(this.Handle,"C:\\temp2