INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Theater view and foreground window  (Read 4415 times)

Don W

  • World Citizen
  • ***
  • Posts: 185
Theater view and foreground window
« on: July 20, 2017, 11:26:50 pm »

I'm writing a little app that is meant to be opened from theater view, via an "external program" item that's added to the roller. This is an interactive app, so it needs to be able to respond to remote control/keyboard events. But theater view won't let go of the foreground. A call to SetForegroundWindow returns false even after several seconds wait, and when I query for the name of the foreground window it is "Theater View DX." The app was explicitly started by direct input from the user, so it makes sense that the app should be allowed to make itself the foreground window. Is it the intention to disallow such a scenario? Is there a known work around? Any chance at all this could be changed?
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8926
Re: Theater view and foreground window
« Reply #1 on: July 21, 2017, 12:46:10 am »

When you configure your external program in MC's Theater View options, there's a check box there that says "Hide Media Center while the program is running".

If you check that, does it make any difference?

robt

  • Galactic Citizen
  • ****
  • Posts: 313
Re: Theater view and foreground window
« Reply #2 on: July 21, 2017, 10:50:30 am »

Sounds interesting.

Are you intending to make it available to others, whatever it does??
Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: Theater view and foreground window
« Reply #3 on: July 22, 2017, 01:50:37 am »

When you configure your external program in MC's Theater View options, there's a check box there that says "Hide Media Center while the program is running".

If you check that, does it make any difference?
No. Actually that option makes it worse in a way. I've found that without that option checked, if I use the mouse to activate my app once, then MC remembers that I did that for as long as I don't close theater view. I can close the app and then re-open it and it will activate without mouse intervention, as long as I don't close theater view. With that option checked I have to activate my app with the mouse every time I open it. I know it's weird but that's what seems to be happening.
Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: Theater view and foreground window
« Reply #4 on: July 22, 2017, 01:52:51 am »

Sounds interesting.

Are you intending to make it available to others, whatever it does??
That will depend on how well I can get it to work :-)
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Theater view and foreground window
« Reply #5 on: July 23, 2017, 09:13:56 pm »

No. Actually that option makes it worse in a way. I've found that without that option checked, if I use the mouse to activate my app once, then MC remembers that I did that for as long as I don't close theater view. I can close the app and then re-open it and it will activate without mouse intervention, as long as I don't close theater view. With that option checked I have to activate my app with the mouse every time I open it. I know it's weird but that's what seems to be happening.

I'm experiencing the same thing with something I'm working on. You aren't by chance trying to send keystrokes from your program are you? I'm attempting to send keystrokes to a browser, in particular F11. For me MC is continues to intercept the F11 key and puts itself back into the foreground in theaterview.

The "Hide media center while program is running" option doesn't seem to work correctly. Similar to what you are saying, if after MC takes over the first time I ALT-TAB and select the browser I launched at that point I can send keystrokes without MC intercepting them. Hopefully it can be fixed.

Since what I'm doing doesn't require MC to be running in the background during that time I can have my program close MC first so it isn't running to interfere. After my program is finished it relaunches MC. An issue I ran into though is if in MC you have the option set to run MC and or MC server at startup you may still have MC processes running in the background. In that case MC will still intercept the keystrokes.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Theater view and foreground window
« Reply #6 on: July 24, 2017, 02:58:49 am »

I found something that seems to help this. Have your program first minimize MC. I don't know what language you are programming with but I'm working with a vb script and if you do something like below first thing it seems to keep MC from interfering.

Set objShell = WScript.CreateObject("Wscript.Shell")
objShell.SendKeys "% n"
Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: Theater view and foreground window
« Reply #7 on: July 27, 2017, 09:39:08 am »

I've created a solution that's based on a Windows global keyboard hook. I tried the idea of minimizing MC as suggested by justsomeguy but it didn't work for me, though I'll admit I probably didn't spend as much time on it as I might have if I hadn't already invested a lot of time figuring out the global keyboard hook. The approach does have other benefits though that I think make it worth the extra trouble.

What I've been working on is an launcher app for YouTube TV, inside of the browser. Coincidentally I noticed that justsomeguy has done the same with vbScript. I am working in WPF, which gives me a bit more power to do things like intercept remote control button presses and shut down the browser. I will start a new thread soon and share it.
Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: Theater view and foreground window
« Reply #8 on: August 02, 2017, 01:39:22 pm »

Here's a link to the thread I started about the new launcher app: https://yabb.jriver.com/interact/index.php/topic,111645.0.html
Logged
Pages: [1]   Go Up