travisjbennett
asked on
How to Steal Focus back to PowerPoint Show in Windows 7
I am trying to support a presentation setup that includes a SmartBoard (a digital whiteboard, kind of like a giant tablet screen) and PowerPoint (on another monitor/projector) on a four-head (aka four monitor) system. This is a one-computer system, running Windows 7.
Unfortuneatly, whenever someone uses the SmartBoard's app, the SmartBoard steals focus from PowerPoint, and then the remote control that the presenter uses is no longer controlling the PowerPoint show. Instead, it sends it's commands (left and right keys or something) to the application in focus.
I've put together some VBA to monitor PowerPoint events for a slideshow starting (works fine), then start a timer to run a subroutine every n (10 here) seconds, which again works fine. I want this subroutine to steal the focus back to the PowerPoint presentation.
It seems Windows 7 (or something) is preventing PowerPoint VBA from stealing the focus, as usually focus-stealing is bad. Here, we need it to keep the remote working.
My current code requests focus, but does not successfully steal it:
Is there any way ya'll know of to forcefully steal the focus?
Maybe edit a registry setting somewhere then change it back when I'm done?
Unfortuneatly, whenever someone uses the SmartBoard's app, the SmartBoard steals focus from PowerPoint, and then the remote control that the presenter uses is no longer controlling the PowerPoint show. Instead, it sends it's commands (left and right keys or something) to the application in focus.
I've put together some VBA to monitor PowerPoint events for a slideshow starting (works fine), then start a timer to run a subroutine every n (10 here) seconds, which again works fine. I want this subroutine to steal the focus back to the PowerPoint presentation.
It seems Windows 7 (or something) is preventing PowerPoint VBA from stealing the focus, as usually focus-stealing is bad. Here, we need it to keep the remote working.
My current code requests focus, but does not successfully steal it:
Sub ActivatePresentation()
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
' Reference existing instance of PowerPoint
Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
'' Some PowerPoint actions work best in normal slide view
'PPApp.ActiveWindow.ViewType = ppViewSlide
' ' Reference active slide
' Set PPSlide = PPPres.Slides _
' (PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
''---------------------
'' Do Some Stuff Here
''---------------------
'Activate PPApp.ActivePresentation
PPApp.Activate
PPApp.ActivePresentation.SlideShowWindow.Activate
' Clean up
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
End Sub
Is there any way ya'll know of to forcefully steal the focus?
Maybe edit a registry setting somewhere then change it back when I'm done?
Have you tried this
http://download.cnet.com/TeamPlayer/3000-2064_4-10902000.html
It will let you use multiple input device in one machine.
http://download.cnet.com/TeamPlayer/3000-2064_4-10902000.html
It will let you use multiple input device in one machine.
ASKER
Sorry -- I should have clarified more.
Thus, I just need something to swich back to PowerPoint, say, every 10-20 seconds. That way, by the time the presenter walks away from the smartboard in the front of the room, all the way to the back of the room (I'd do it too), the remote works again. And, if refocused to the PowerPoint show, the smartboard would still be able to steal control instantly (as the pen is the cursor, and the window was just clicked).
Wow, that just made me think of something. I know I can get the window position and dimensions (in pixels) of the PPT show. Is there a way to via VBA position the cursor and send a mouseclick? Like with sendkeys or something? (Please don't say only way is through impractical mousekeys.)
Or any other way to steal focus, maybe with a deep API?
I might have to try that TeamPlayer thing...
The pen ALWAYS works on the smartboard, and steals focus (including cursor position) when used automatically, even if the PowerPoint presentation had focus on a different screen.
The PowerPoint remote, however, requires focus be reapplied to it's target application (the PPT Presentation) prior to it working.
Thus, I just need something to swich back to PowerPoint, say, every 10-20 seconds. That way, by the time the presenter walks away from the smartboard in the front of the room, all the way to the back of the room (I'd do it too), the remote works again. And, if refocused to the PowerPoint show, the smartboard would still be able to steal control instantly (as the pen is the cursor, and the window was just clicked).
Wow, that just made me think of something. I know I can get the window position and dimensions (in pixels) of the PPT show. Is there a way to via VBA position the cursor and send a mouseclick? Like with sendkeys or something? (Please don't say only way is through impractical mousekeys.)
Or any other way to steal focus, maybe with a deep API?
I might have to try that TeamPlayer thing...
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
ve3ofa,
This works so well on a normal rig! Thanks! I hadn't thought of using WScript, and it makes since that it would have the permissions to do so.
Sadly, the application that runs the whiteboard seems to somehow be running as a system-modal application, and in itself (or how it was launched) prevents other applications from stealing focus.
Thus, in general, it's a valid solution. It doesn't work for the target setup though, and we suspect nothing will short of getting the original developer to change the modality of their whiteboard app.
We've kept the developments made, as I can see it being a handy plug-in/app perhaps on other systems. But thanks again!
This works so well on a normal rig! Thanks! I hadn't thought of using WScript, and it makes since that it would have the permissions to do so.
Sadly, the application that runs the whiteboard seems to somehow be running as a system-modal application, and in itself (or how it was launched) prevents other applications from stealing focus.
Thus, in general, it's a valid solution. It doesn't work for the target setup though, and we suspect nothing will short of getting the original developer to change the modality of their whiteboard app.
We've kept the developments made, as I can see it being a handy plug-in/app perhaps on other systems. But thanks again!
You will need another application / script to change the focus for you. The problem being that the person using the smart board on the focus switch will have their inputs sent to PowerPoint. Probably not what you want.
The most workable solution is to run the smart board in a virtual machine, and using something like teamviewer / real vnc / join.me have the smart board controlled by a second computer. This way the presenter can keep PowerPoint in focus.