window程序可以使用
CWnd::GetActiveWindow  
static CWnd* PASCAL GetActiveWindow( );
 
java中可以试一试
java.awt 
Class KeyboardFocusManager
java.lang.Object
  |
  +-java.awt.KeyboardFocusManagerpublic Window getActiveWindow()
Returns the active Window, if the active Window is in the same context as the calling thread. Only a Frame or a Dialog can be the active Window. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window.