View Full Version : How can I detect whether an app has the focus?
mixedup
October 7th, 2005, 04:46 PM
Hi,
Q1 - How can I detect if application A has the focus or not so that I can program a remote key with effectively some IF/THEN logic. Eg if it doesn't have focus do X & Y, but if doesn't have the focus just do Y?
Q2 - Also how best to defocus an application? (set focus to the background???)
Background - I have an issue with my 2005 MCE remote which is described at:
http://www.xpmce.com/forum/how-can-i-disable-some-keys-on-the-mce-remote-vt95782.html
Thanks
Promixis
October 7th, 2005, 05:43 PM
see the focus example in the downloads area.
mixedup
October 7th, 2005, 06:56 PM
Hi Mike,
I've just gone through the 2 examples in the downloads area (the two with focus in the title) and haven't found an example of how to defocus an application?
Any other pointers?
Thanks
Promixis
October 8th, 2005, 03:22 PM
you want to detect an app when it goes out of focus or force another app into focus?
mixedup
October 8th, 2005, 06:59 PM
neither actually Mike,
I'm want to be able to force an application (it's main window) to un-focus. Any ideas?
Background: It probably sounds like the weird thing to be asking, however the reason is that I have a microsoft MCE remote I'm using for some PVR software I have. I'm using girder to map the keys which is great, however for some keys on the MCE remote the underlying drivers want to send them out to the active application. The arrow keys are the main issue. I'm working on the model of sharing the PC between a PC user and a TV/PVR watcher via sending the PVR output to the TV OUTPUT. The remote + girder + gbpvr software have to function with the PVR software (GB-PVR in my case) not with the focus. This all works fine except for the ARROW KEYS which the MCE REMOTE drivers will always want to send to the application in focus (I'm following this up separately looking for a resolution).
The issue is when GB-PVR has the focus it is getting the arrow key sent to it twice (once from girder, and once via the underlying remote drivers)
Idea - If I can just ensure that GB-PVR doesn't have the focus before these keys are pressed I should be fine. So just looking for a way to de-focus GB-PVR, irrespective of what other applications (if any) are running.
Make any sense?
Thanks for taking the time - any suggestions welcome
Promixis
October 9th, 2005, 05:23 AM
makes sense...
but what about trying to block the keys using the keyboardex plugin..
other wise I would use the lwinfunc plugin and the forceforeground window command...
something like ForceForegroundWindow (GetDesktopWindow ())
mixedup
October 9th, 2005, 12:08 PM
thanks Mike
I still want to use the keys in girder so "ForceForegroundWindow" idea sounds good. I'll look into this. thanks
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.