I had a need to hide some items under "More Programs" menu in Vista Media Center app.
Unfortunately there appeared to be no way to create a real filter that would help me to apply some "programmatic" criteria to such area of MCE. However, I just found the simplest way to hide items there. All you need to do is to remove the entry points (application registered in MCE) from the following key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Extensibility\Entry Points]
For instance, I knews that the following registry key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Extensibility\Entry Points\{115EADF1-41C4-471b-8FE5-7A52B91BFE75}]
is the entrypoint for Chess Game item of the "More Programs" menu. It is easy to prove if you look under the key and find the "Run" value there. It points to %ProgramFiles%\Microsoft Games\Chess\ChessMCE.lnk shortcut which is obviously responsible for launching the Chess Game.
All I had to do to hide the Chess is to remove the entrypoint registry key.
The main reason I wanted to hide the game items (or any other registered program items) is that some of them still don't comply to the 10 foot UI requirements. Some games are totally 2' UI based and require mouse and keyboard - not sure who decided to put those in the MCE which is supposed to target TV users as well (and hopefully soon will not target PC users!).
Showing posts with label MCE tips. Show all posts
Showing posts with label MCE tips. Show all posts
Thursday, May 10, 2007
Wednesday, May 9, 2007
MCE tip #2: How to launch Media Center app directly to the setup screen
There a re a few places on the web (e.g., The Green Button, Media Center Sandbox Blog, driverheaven.net, etc.) that discussed various way how to launch Media Center and direct it to particular applications. Two most command ways - command line arguments (directmedia and homepage switches) or sending a Win32 message to the MCE window with certain wParam and lParam settings.
I have read all the info and played with it myself. Too many limitations there. Basically you can only redirect the MCE to some [very few] applications - to Live TV, Video Library, etc..
A hacky way I tried - to grab the XML resource names off the MCE binaries - didn't work well. Most of the XML pages there require some machine state variables being passed from the main application entrypoint and this makes the MCE unstable. Mostly it just crashes at the launch.
Only helpful XML page I found I could bring up that way, that wasn't mentioned on the Web, was the Media Center Setup page. All you have to do is to launch MCE with the following command line:
%SystemRoot%\ehome\ehshell.exe /homepage:Options.SetupMediaCenter.xml /PushStartPage:True
I have read all the info and played with it myself. Too many limitations there. Basically you can only redirect the MCE to some [very few] applications - to Live TV, Video Library, etc..
A hacky way I tried - to grab the XML resource names off the MCE binaries - didn't work well. Most of the XML pages there require some machine state variables being passed from the main application entrypoint and this makes the MCE unstable. Mostly it just crashes at the launch.
Only helpful XML page I found I could bring up that way, that wasn't mentioned on the Web, was the Media Center Setup page. All you have to do is to launch MCE with the following command line:
%SystemRoot%\ehome\ehshell.exe /homepage:Options.SetupMediaCenter.xml /PushStartPage:True
Extending and fixing MCE
What you can do if you want to change some functional behaviour of MCE (Media Center application) or add some more functionality there? Or what you can do if you need to fix some 2 or 10 foot UI issues of the Media Center app?
Well, the only way I could come up with is - a global hook or Dll-injection. There are a few techniques known in Win32 world (I wish those exist in Windows CE as well :-) ) how to do the Dll injections (from writing to another process address space to the supported global hooks). Despite the fact that it may be a dangerous implementation (stability issues, lowering security, etc.) this is the only way that seems viable. Two main reasons:
- to have a better and faster implementation for your own monitoring agent application you'd probably want to stick to C/C++ to easier the access to Win32 APIs (P-Invoke's are costly and require lots of coding for missing header). MCE SDK doesn't allow you to write add-ins in native C++. (or perhaps it does but I didn't investigate this deep enough)
- too many limitations there on background add-ins for Vista MCE. You will always lose the MCE launch moment and some other events as well.
I have implemented a MCE hook-up agent that keeps monitoring the Media Center app on a complex of things - messages, windows, positions, etc. - including WM_INPUT (raw input messages), keyboard and mouse messages and etc.
A piece of advice - if you are playing with MCE on Vista, try to stay away from a service implementation for your app. On Vista, services are running in a separate, isolated Windows session (session 0) and it may take you an effort to implement the cross-session interface between your hook into MCE and the service. (not impossible but just over-complicates the implementation)
Well, the only way I could come up with is - a global hook or Dll-injection. There are a few techniques known in Win32 world (I wish those exist in Windows CE as well :-) ) how to do the Dll injections (from writing to another process address space to the supported global hooks). Despite the fact that it may be a dangerous implementation (stability issues, lowering security, etc.) this is the only way that seems viable. Two main reasons:
- to have a better and faster implementation for your own monitoring agent application you'd probably want to stick to C/C++ to easier the access to Win32 APIs (P-Invoke's are costly and require lots of coding for missing header). MCE SDK doesn't allow you to write add-ins in native C++. (or perhaps it does but I didn't investigate this deep enough)
- too many limitations there on background add-ins for Vista MCE. You will always lose the MCE launch moment and some other events as well.
I have implemented a MCE hook-up agent that keeps monitoring the Media Center app on a complex of things - messages, windows, positions, etc. - including WM_INPUT (raw input messages), keyboard and mouse messages and etc.
A piece of advice - if you are playing with MCE on Vista, try to stay away from a service implementation for your app. On Vista, services are running in a separate, isolated Windows session (session 0) and it may take you an effort to implement the cross-session interface between your hook into MCE and the service. (not impossible but just over-complicates the implementation)
Thursday, March 29, 2007
MCE tip #1: TBP (ToolBar Persisted)
I have recently had to investigate whether it is possible to remove mouse-over toolbar from MCE (Media Center Edition application). That toolbar seems to have similar (actually, the same) implementation both on MCE 2005 and Vista MCE.
On Vista MCE (not sure about MCE 2005 - didn't have time to check it out there) there is a nice item under Tasks menu - "Media only" - which purpose is basically to make the app to run full screen and hide the mouse toolbar at the right top corner of the application window. This option however doesn't persist. If you restart the application or simply reboot, the mouse toolbar comes back (it only appears when you move mouse cursor while the app is running, of course).
I got around this by doing the following two things:
- making my monitoring agent application (see the other post "Vista tip #1") to watch on the MCE windows (certainly had to hack around a little bit first to get to know all the necessary window class names and etc.). If something wrong happens to the full screen MCE app window, I set it back - always on top, full screen, foreground, etc.
- completely removing the mouse support from the image. Not PS2 nor an USB mouse would work there, hence no way for end user to mess with the mouse-over toolbar of the MCE app.
(I needed the second also to get rid of the mouse cursor there).
Anyway, this tip is not about how to remove the toolbar. It is rather opposite - how to make it persistent so that all the MCE controls including the mouse-over toolbar are always there. (in PC mode users may like it)
For MCE unattended setup there is an option (TBP) in XML file that allows you to specify whether mouse toolbars always appear in the Windows Media Center UI: http://technet2.microsoft.com/WindowsVista/en/library/524ca8fc-af68-4e5a-9d68-3cc678a270091033.mspx
Now, where is the registry key is located? Here it is: [HKCU\Software\Microsoft\Windows\CurrentVersion\MediaCenter\Capabilities],"TBP"=dword:1.
On Vista MCE (not sure about MCE 2005 - didn't have time to check it out there) there is a nice item under Tasks menu - "Media only" - which purpose is basically to make the app to run full screen and hide the mouse toolbar at the right top corner of the application window. This option however doesn't persist. If you restart the application or simply reboot, the mouse toolbar comes back (it only appears when you move mouse cursor while the app is running, of course).
I got around this by doing the following two things:
- making my monitoring agent application (see the other post "Vista tip #1") to watch on the MCE windows (certainly had to hack around a little bit first to get to know all the necessary window class names and etc.). If something wrong happens to the full screen MCE app window, I set it back - always on top, full screen, foreground, etc.
- completely removing the mouse support from the image. Not PS2 nor an USB mouse would work there, hence no way for end user to mess with the mouse-over toolbar of the MCE app.
(I needed the second also to get rid of the mouse cursor there).
Anyway, this tip is not about how to remove the toolbar. It is rather opposite - how to make it persistent so that all the MCE controls including the mouse-over toolbar are always there. (in PC mode users may like it)
For MCE unattended setup there is an option (TBP) in XML file that allows you to specify whether mouse toolbars always appear in the Windows Media Center UI: http://technet2.microsoft.com/WindowsVista/en/library/524ca8fc-af68-4e5a-9d68-3cc678a270091033.mspx
Now, where is the registry key is located? Here it is: [HKCU\Software\Microsoft\Windows\CurrentVersion\MediaCenter\Capabilities],"TBP"=dword:1.
Subscribe to:
Posts (Atom)