Decorum for the Forum:
  • Be nice. If you want to be mean, try Reddit.
  • No Piracy. If you want to be a thief, there are dark places on the internet dedicated to that.
  • No Cracking. Discussions on AnyDVD, DeUHD, DVDFab, UHDKeys and similar tools are not permitted here.
  • No Spamming. If you want to make a buck, work smarter... somewhere else.
  • No Adult Content. Half the internet is dedicated to adult content. This half isn't.

Privacy Policy: Click Here to Review (updated September 30, 2020)

Considering New App - Hotkey Monitor

General support forum for Chameleon MediaCenter (formerly MM Browser)
Post Reply
User avatar
Pauven
Posts: 2777
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Considering New App - Hotkey Monitor

Post by Pauven » Sun Jan 31, 2021 2:36 pm

One of the ongoing challenges for having CMC work reliably from the comfort of your favorite chair is proper support for MCE Remotes and reliable app behavior when you press a button. Though I've spent countless hours trying to make CMC work reliably well with an MCE remote, the end result is still lacking - and for that I place the blame squarely on Windows.

For example, even though CMC creates a Windows Shortcut to launch CMC that includes a Hotkey combo to trigger the shortcut, Windows prevents the shortcut from executing if the target program is already running. While at first glance that seems like a fair result to prevent accidentally running multiple copies of a program, it breaks the ability of a 2nd copy of CMC to bring the initial instance to the top and into focus.

Additionally, Windows captures the hotkey combo and prevents running apps from seeing it. For example, CTRL+ALT+8 is the hotkey I programmed for launching CMC. If you press that combo while CMC is already running, CMC sees only "CTRL+ALT", and not the 8. So I can't even program CMC to monitor for that keystroke and take action, since Windows captures it.

I've also noticed that CMC takes a few extra seconds to launch via hotkey - I believe that this is Windows checking to see if the target program is already running before launching a new instance. As hard as I've worked to make CMC launch quickly, it frustrates me that Windows is slowing it down for a feature I don't even like.

So I have a couple ideas on how to tackle this challenge for a future version of CMC, and thought I would post them here for comment.


Add Additional Hotkeys for refocusing CMC
This first option is perhaps the simplest. CMC already has many hotkeys programmed into it, and they work pretty great. The idea here is to simply add a new hotkey that will refocus CMC and bring it to the top. You could map this hotkey to your remote, and any time you find CMC not responding because it has lost focus, pressing the configured button would hopefully resolve the issue.

This does have some potential problems. First of all, it requires you to dedicate an extra button on your remote for this behavior, and perhaps you are already running short of buttons. Second, if CMC has lost focus, then it probably won't even see the hotkey to respond to it. And third, Windows actively tries to block apps from stealing focus. Put altogether, I'm thinking that this is a pretty bad idea.


Create a new background process to monitor Hotkeys
This idea has been suggested to me by several users over the years, and I've been resistant to it simply because I felt I could solve the problem in CMC itself. Now that Windows has utterly defeated those efforts, I'm reconsidering this idea.

Basically, I would create a new standalone app that would run either in the System Tray or as a Background Process. It would monitor for certain hotkeys, and when it sees them it would take the appropriate action. It would be smart enough to know that if CMC is not running, then to launch CMC, but if CMC is running then to bring CMC into focus to respond to commands. I'm thinking that this app could reduce CMC launching time by 1-2 seconds.

There are some unknown challenges with this approach. First, I'm worried what a virus scanner will think of a background process that monitors keystrokes. It's very possible this will look like keylogger malware. I'm also not sure if I can successfully have it monitor for all keystrokes while running in the systray or as a background process. Basically, for this app to be successful, it needs to see every keystroke no matter what app is running. There's also the concern of what users may think of such an app. Are you guys open to the idea of a keystroke monitor running 24/7 on your HTPC's? Or is this crossing a line? I'm thinking use of such an app would have to be optional, of course, but if no one is willing to run such an app I don't think I should waste time programming it.

If I did create such an app, it would allow for some advanced functionality that is not possible today. For example, the current Wake-on-LAN solution on works if CMC is running, so that doesn't solve the need for users who want to send a WoL magic packet on login or boot. If this new app ran as a background process launched at system startup, then it could also handle those advanced WoL scenarios.


3rd Party Solutions
The above two options were all I could come up with, though I'm certainly open to other ideas.

Additionally, it occurred to me that perhaps there's already a good hotkey tool produced by someone else. The requirements for launching CMC are really basic, so I'm thinking pretty much any old hotkey tool could get the job done. In my research into the various Windows limitations for hotkeys, several times I came across users commenting on how you needed 3rd party tools to get the desired behavior that Windows fails to deliver.

I've never used any of these tools, so if anyone has recommendations please let me know.
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Teddyboy
Posts: 268
Joined: Wed Apr 25, 2018 10:30 pm
Location: San Diego, Ca

Re: Considering New App - Hotkey Monitor

Post by Teddyboy » Mon Feb 01, 2021 7:36 pm

Many moons ago I used to use a app LM Remote Keymap
Here’s a use example on the Kodi forum.
https://forum.kodi.tv/showthread.php?tid=34436
https://forum.team-mediaportal.com/thr ... ote.74398/
Here’s a couple of YouTube examples on how to use it.
https://youtu.be/wdspdQ0mVtY
https://youtu.be/9XimH2xQjtI

I liked using it as I could easily customize The remote. I could program hot keys for various apps mostly players. It was easy to use. It’s basically abandon ware. The site is gone, but you can get to the site archive through the wayback machine. It’s is lmgestion.net
It might give you some ideas on how to develop your own app or take a look at the two listed below as they are actively developed and have been around for years. There is plenty of support if you wanted to develop something based around one of the two listed below. I would prefer to get away from registry tweaks and some thing more customizable and reliable.

There is eventghost http://www.eventghost.net/and girder https://www.promixis.com/girder.php
A forum post about using eventghost with PowerDVD 20 http://eventghost.net/forum/viewtopic. ... dvd#p55930
Here’s a couple of demonstrations using event ghost:
https://youtu.be/YtS0ZEU2EyY
https://youtu.be/BJzZeQam9Ns
Hope this helps you Paul!
Efrain
Mechanical Engineer, Solidworks junkie, Reef aquariums, sci-fi, weight training, orchids, Ferns, Kaiju, model kit building, balboa park, scripps aquarium

User avatar
Pauven
Posts: 2777
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: Considering New App - Hotkey Monitor

Post by Pauven » Tue Feb 02, 2021 9:33 am

That's incredibly informative, thank you so much Efrain! I'll be sure to review all of it.

I recall playing around with LM for a bit back in the CMC 1.x days, but at the time I didn't like how it was always running. I might event still have a copy here somewhere. Interesting how what seemed like a bad feature a couple years ago now seems like a good idea.
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Teddyboy
Posts: 268
Joined: Wed Apr 25, 2018 10:30 pm
Location: San Diego, Ca

Re: Considering New App - Hotkey Monitor

Post by Teddyboy » Wed Feb 03, 2021 9:01 pm

I think eventghost or girder might be the way to go. They can really do a lot. You would develop plugins for either application. They are very sophisticated. Back in the HTPC golden era they where the go to apps for automation and remote control. The switching between apps is seamless. You can create a plug-in that only allows you to press certain buttons for that particular application. If you press a button that would take you out of display view in jriver you could make that button do nothing. Only the buttons for playback and menu navigation would be available. It would be nice if you could get away from registry tweaks, so I wouldn’t have to drag out my keyboard and mouse twice a year at least to reapply the remote settings. I’m curious to hear what you think after you’ve looked at the links. Granted this would be more of a long term solution.
Mechanical Engineer, Solidworks junkie, Reef aquariums, sci-fi, weight training, orchids, Ferns, Kaiju, model kit building, balboa park, scripps aquarium

User avatar
Pauven
Posts: 2777
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: Considering New App - Hotkey Monitor

Post by Pauven » Thu Feb 04, 2021 8:13 am

CMC's MCE Remote programming feature is entirely optional and purely for convenience. It is a super dummed-down version of the Advanced MCE programming tool. It is mainly intended for users who struggle with technology, though it works well enough that I use it myself, and I think most CMC users use it too (just a guess based on feedback).

From that perspective, you could certainly use eventghost or girder today if that's your preference.

I am planning a tweak to CMC to request admin privileges on Registry update, instead of forcing you to start CMC as admin. I also plan to have it auto prompt to update on startup if the Registry doesn't match. But the main problem with this approach is that because Microsoft resets the Registry, you can't even launch CMC from the remote to even begin the reprogramming process. It's a catch-22.

When I'm looking at tools like girder and eventghost, I'll be doing it with an eye towards having the least techie CMC user successfully implement it. If it's too cumbersome, it's probably a direction I won't go, because I always end up supporting it, just like I provide a ton of support for My Movies.

I'm still thinking developing my own app from scratch might be the best choice from a support perspective. I can make it streamlined and friendlier for non-techies.

The end result might actually be three different pathways for each user to choose from. CMC's built-in programmer for basic needs, a custom systray app for advanced needs, or 3rd party apps for techie users who have the need and desire to configure them.
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

User avatar
Pauven
Posts: 2777
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: Considering New App - Hotkey Monitor

Post by Pauven » Thu Feb 04, 2021 9:05 am

Okay, I just finished checking out the videos and looking at EventGhost, Girder, and LM. These are all awesome, powerful solutions. And I believe they are all beyond the reach of non-techies. I don't feel that they align with one of my core goals, to make CMC so easy to use that anyone can do it (yes, I know CMC could be a lot better in this regard, I'm working on it...).

Like I said, nothing would prevent you or any other techie person from using any of those solutions if that's what you prefer. But I feel that there is a lot of fertile ground left untapped between an off-the-shelf Blu-ray player and a fully customized multi-app HTPC. And I believe that is the reason that HTPC popularity has taken such a big hit - it's just too cumbersome. Everything needs to be streamlined, easier, and dummed-down, to make it accessible to a larger audience.

Yes, that probably means that the solution I come up with won't meet your goals if you seriously need the power of EventGhost, but in that case just use EventGhost.

I'll have to add it to my to-do list to look at creating plugins for EventGhost and other solutions, to help users that want to go that path, and for that reason I definitely appreciate you pointing these out to me.
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Teddyboy
Posts: 268
Joined: Wed Apr 25, 2018 10:30 pm
Location: San Diego, Ca

Re: Considering New App - Hotkey Monitor

Post by Teddyboy » Thu Feb 04, 2021 1:51 pm

I am a power user, but I'd prefer not to be when it comes to what I'm doing with CMC. I want it to be easy to use as much as possible. I want to watch my movies and enjoy my collection that is now starting to grow again. I just wanted to point out some other applications to give you some ideas for making your own. You only really need a subset of what they do. It's possible that what you come up with will be just fine for me. I just want to make sure that the players don't take me out of the experience if I press the wrong button. Maybe I'd have to use Advanced MCE to do that, but I want to be able to keep those tweaks without having to get out a keyboard and mouse every time windows does a major update.

You have a catch 22 when windows updates and the remote stops working. It might be that you could just force the update with a saved version of the button configuration when it was initially set up. dumbed down is fine, as long as it's seamless and the remote is well integrated so that it does not ruin the experience. I have a apple tv 4k. I don't think you can get anymore simple then that. HTPCs are computers at one point I bought a book on embedding windows7 to preserve MCE7 with MyMovies. It wasn't going to be cheap to do it, but it would have frozen the install and made it stable enough to use for several more years.

Please don't think that I'm after some ultra sophisticated thing that everyone has to jump through hoops to use. Ultra sophisticated under the hood, but simple to use. That's the hard part. ;)
Mechanical Engineer, Solidworks junkie, Reef aquariums, sci-fi, weight training, orchids, Ferns, Kaiju, model kit building, balboa park, scripps aquarium

User avatar
Pauven
Posts: 2777
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: Considering New App - Hotkey Monitor

Post by Pauven » Thu Feb 04, 2021 2:58 pm

I ended up installing EventGhost plus the source code, and have been playing around with it.

In EventGhost I could install the MCE Remote plugin and monitor for MCE button presses, even those not configured, which is freaking awesome. But this only works if I run EventGhost as Administrator.

I've created a new test app, and I'm hooking it to the MceIr.dll that is used by that plugin, using the EventGhost source code for reference. While it seems to load up and interact with the MceIr.dll okay, I never get any messages from it, even when I run my test app as Administrator. I'm currently troubleshooting this, trying to figure out why it's not working. If I can get this to work, then this would make a great foundation for a MCE remote monitor app.
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

User avatar
Pauven
Posts: 2777
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: Considering New App - Hotkey Monitor

Post by Pauven » Thu Feb 04, 2021 3:38 pm

Woohoo! I just got it to work! Once I passed the correct Windows Handle to the MceIr.dll, and ran my test app as Administrator, I started receiving all the MCE button presses!

It's working even better than I could have hoped. I was only hoping to get the special media buttons like GUIDE or VIDEOS or RECORD, but it actually gives me every last button pressed on the remote. I always thought the generic buttons, like the numberpad, were treated as regular keyboard input (in fact, that's how CMC sees it). I had not idea I could separate MCE numbers separate from keyboard numbers. When I press keyboard characters, nothing happens, so everything in this screenshot came from the MCE remote.

image.png
image.png (63.92 KiB) Viewed 4310 times

The downside is that this is now restricted to just MCE Remotes. Jamie recently mentioned he was using a keyboard, and this type of solution may not work for that input method (unless it's an MCE Keyboard... I have one of those somewhere, need to test it.

The other cool thing is that my test app is receiving MCE Remote button presses even after I launch CMC. So it's receiving everything in the background, nice!!!
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

User avatar
Pauven
Posts: 2777
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: Considering New App - Hotkey Monitor

Post by Pauven » Thu Feb 04, 2021 4:10 pm

Pauven wrote: Sun Jan 31, 2021 2:36 pm I've also noticed that CMC takes a few extra seconds to launch via hotkey - I believe that this is Windows checking to see if the target program is already running before launching a new instance. As hard as I've worked to make CMC launch quickly, it frustrates me that Windows is slowing it down for a feature I don't even like.
YESH!!! I was right!!!

I programmed my test app to launch CMC when I press "My Videos" (a button not otherwise programmed to do anything), and it launches CMC with no delay.

When I press the "Big Green Button", which is programmed through CMC to call the CMC shortcut via hotkey CTRL+ALT+8, there is a 3 second delay before CMC starts launching.

It also works to refocus CMC when another app steals focus, plus it isn't blocked from launching CMC a second time if it's already running, as the Windows hotkey method seems to do.

Now, one limitation (so far) is that button presses are not blocked by my test app. That can be a positive or a negative depending upon your viewpoint. If you were wanting the test app to intercept a button press and prevent it from reaching JRiver, for example, this won't do it. Instead, it's more like a silent observer, monitoring all button presses, and I can have it take action when it sees certain buttons being pressed.

EventGhost has a setting to disable HID for MCE Remotes, and I think that blocks the MCE remote from sending any button presses to any apps, and instead EventGhost handles them all. In this way it can block, remap, or send unchanged any button press. This appears to be just a simple Registry entry to disable HID (plus a reboot to effect the change). I'm not sure if that's where I want to go. My main goal was just to consistently get MCE Remote button presses even if the Registry wasn't updated, and to take certain actions for certain buttons. I can do that without disabling HID. But for advanced features like blocking certain button presses, I'd need to both disable HID and create a process to pass on button presses.
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Post Reply