Doug Lee wrote:
If I understand the filter-by-window in keyboard.registerHotkey technique correctly, you would need to be careful that the window you're watching does not come and go, such as when it's part of a dialog. Window handles generally remain valid unless they fall within something that can close.
Right. If a window that hotkeys are registered to goes away, the hotkeys will cease to function. If another window gets created using the same handle as the window object associated to the registered hotkeys, then they will come alive again. That is a possibility. So, as you alluded to, you will be better off watching for the coming and going of a window if you expect that's something the window is likely to do.
Another thing to watch out for, in some applications anyway, is the possibility of multiple MDI windows. Applications such as Word that can show multiple files at once are good examples. The approach of hooking OnChildFocus/Blur at the application window level would work best for those, because you can then check for class/module and grab all MDI child windows of interest rather than accidentally hooking the first one that opens and missing the rest, or forgetting one when another opens, etc.
Yep. Sonar is a good example of that kind of situation. For it, I had the most luck using the Window events OnMDIActivate, OnMDIChildActivate, OnMDIDeactivate, and OnMDIChildDeactivate.
Aaron -- To insure that you receive proper support, please include all past correspondence (where applicable), and any relevant information pertinent to your situation when submitting a problem report to the GW Micro Technical Support Team. Aaron Smith GW Micro Phone: 260/489-3671 Fax: 260/489-2608 WWW: http://www.gwmicro.com FTP: ftp://ftp.gwmicro.com Technical Support & Web Development
