March 24, 2004
Copyright � 2004
Charles E. Kindel, Jr. All Rights Reserved.
This version of MCE Controller is distributed as
freeware for non-commercial use. Donations of any value appreciated.
Make donations using
email@example.com. If you want to use MCE Controller for a commercial
purpose, contact me at firstname.lastname@example.org
for licensing information.
MCE Controller allows the
application of Windows Media Center Edition (MCE) to be integrated into an
advanced control system by enabling programmatic control of the user interface
via a TCP/IP connection.
To put it simply, MCE Controller, allows you to simulate a
press of any button on the MCE IR remote control by sending a text command to a
TCP/IP port on the MCE machine. For example if
receives the string �mypictures
� it will tell
to go to the �My Pictures� page.
This application was initially developed to enable integration
of MCE into a
whole-house audio/video system. However, it is general enough that it can be
utilized from any control system that supports sending text strings to a TCP/IP
port. Most control systems, such as
or AMX, support IR emitting. For many applications, emitting the MCE IR
commands will suffice. However, for some installations the reliability of IR
emitting and other factors may make IR emitting problematic and MCE Controller
offers a robust solution.
MCE Controller can act as either a TCP/IP client or server.
When acting as a client the target host and port can be configured. When acting
as a server the incoming port can be configured.
MCE Controller runs showing only a taskbar icon. By double
clicking on the taskbar a status window is displayed that shows a log of all
activity. You can also right-click on the taskbar icon for a menu.
See the Revision History below for details of what's new in
Important Note: MCE Controller requires the .NET Framework 1.1. Use
Windows Update to ensure you have this installed before running MCE
MCE Controller is a very simple application that does not
require an installation program. The distribution ZIP file includes three
You are reading the first file, so you know what it does.
is the program executable and
is an XML file that defines the commands MCE Controller will respond to and
what actions it will take.
files to some directory on your machine (e.g.
file must be in the same directory as
Note: If you are upgrading from a previous version and
have modified MCEControl.commands you should compare your
version of MCEControl.commands with the new one and update
yours as appropriate.
Create a shortcut in your startup directory that points to
Just accept all the defaults for the shortcut (e.g. DO NOT change the working
directory or how the window is shown).
runs, it defaults to showing itself as only a taskbar icon. Double clicking on
the taskbar icon will show the configuration/status window.
If you would like it to show it�s configuration/status window
upon startup, uncheck the �Hide Window at Startup� checkbox in the settings
Note that all configuration settings are stored in a file that
will be created in the program directory when MCE Controller is first run. The
configuration settings file will be named
You can run multiple instances of MCE Controller. To do so
simply copy the EXE to a 2nd directory along with the .commands
file. Each copy will have its own independent
MCE Controller can act as either a TCP/IP client or server (it
can actually operate as both simultaneously, but it�s unlikely it would ever be
useful to do so). By default MCE Controller is configured to act as a TCP/IP
server listening on port
You can change this behavior using the Settings dialog described below.
The Client Tab
The Client tab in the Settings dialog controls MCE
Controller�s TCP/IP client functionality. When acting as a client, MCE
Controller will repeatedly try to connect to the specified port on the
specified host and wait for commands to be sent from the host. MCE Controller
sends nothing to the host.
Enable Client. This checkbox
enables or disables the TCP/IP client functionality. If enabled, the followings
Host. This is the IP address or
host name of the server MCE Controller is to connect to.
Port. This is the port that MCE
Controller will connect to.
Reconnect Wait Time. This is the
number of milliseconds (default is 20 seconds or 20000 ms) MCE Controller will
wait before trying to reconnect to the host once a connection has been dropped
or a connect fails.
The Server Tab
The Server tab in the Settings dialog controls MCE
Controller�s TCP/IP server functionality.
When acting as a server, MCE Controller will open the specified port and wait for a
client to connect. When a client does connect MCE Controller will wait for
incoming commands until the client closes the connection.
Enable Server. This checkbox
enables or disables the TCP/IP server functionality. If enabled, the followings
Port. This is the port that MCE
Controller will listen on.
Enable Wakeup. If enabled, MCE
Controller will attempt to connect to the specified host/port, send the �Wakeup
command� and disconnect when it first starts. When it shuts down it will send
the �Closing command�. This functionality is useful when the remote client
needs to be notified that MCE Controller is ready (for example after the MCE PC
See the Included Commands
section below and the contents of the
file for a list of all of the commands
supports by default.
To test MCE Controller (in server mode) open a telnet session to whatever port
MCE Controller is configured to open and type commands. For example
and a carriage return will cause an �Alt-Tab� keystroke to be generated on the
command will launch
and cause it to be maximized. If you do not want this behavior, change
such that the
command does not have the embedded
to work property the target application (Media
) must be the active window (foreground) on the desktop. You
can use the
command to cause
to be the foreground app if it�s already running. Alternatively you can just
as it will end up causing the same thing to happen (although not as quickly).
Also, you may find that
greenbutton is a better function than mcestart
because it is equivalent to the green-button. mcestart is a
bit different because if MCE is already running mcestart
will not go to the "start" screen of MCE while
However, greenbutton does
not cause the MCE window to be maximized.
MCEControl.commands included with MCE Controller includes the following
commands that can control Windows Media Center. See the section
below for instructions on how to add, remove, or change these
commands. Note that there are some other commands in
MCEControl.commands text such as
"notepad" which starts notepad.exe. These are there just for
Launches the eHome shell and makes it the foreground,
Causes the machine to shutdown.
Causes the machine to reboot.
Causes the machine to go into standby mode.
Causes the machine to go into hibernate mode.
Causes the eHome shell to maximize; ehshell must be running.
Causes the eHome shell to be the active, foreground window;
ehshell must be running.
Maximizes the current foreground window.
Performs an "Alt-Tab" task switch; useful for testing.
Equivalent to the Back button on the MCE remote.
Equivalent to the closed caption button on the MCE remote.
Equivalent to the DEL key.
Equivalent to the green button. ehtray.exe must be running for
this to work. ehtray.exe will be running after ehshell.exe
runs the first time after boot, or you can put ehtray.exe in
your startup folder.
Recorded TV button.
Extending MCE Controller
The MCE Controller code currently has no specific dependencies
. All MCE specific data is encapsulated in the
file found in the same directory as
Therefore, MCE Controller is actually a generic mechanism for exposing UI
commands on the network. It already supports sending any message or keystroke
and can launch arbitrary processes.
To utilize this functionality all you have to do is edit the
file to suit your needs.
supports four types of commands:
, Shutdown, and
commands send keystrokes. Any combination of shift, ctrl, alt, and left/right
Windows keys can be used with any key code. See the
file in the Windows SDK for a definition of all standard VK codes.
API to send keystrokes. Keystrokes go to the foreground window. Use a
element to set the foreground window to the target app by specifying the app�s
top-level window class name (e.g. �ehshell
For example, the following causes a Ctrl-P to be send to the foreground window,
and if that window is Media Center, the My Pictures page to appear:
Ctrl="true" Alt="false" />
commands are just that. They cause MCE Controller to send a Windows message
API to the foreground window if no class name is specified, or to a particular
window if that window�s class is specified.
For example, the following is equivalent to sending a
flag, causing the window with the class name of �ehshell�
to be maximized (WM_SYSCOMMAND == 247
SC_MAXIMIZE == 61488):
commands start processes. Process commands support chaining using the
element. The embedded command will be executed after the started application
starts processing windows� messages.
For example, the following launches
and maximizes it:
Shutdown commands can
shutdown, restart, suspend, or hibernate the machine. The
Type attribute determines the type of shutdown to perform.
Type can be "shutdown", "restart", "suspend", "hibernate",
and "abort". All are self explanatory except "abort" which,
if issued within 30 seconds of issuing a "shutdown" or
"restart" command will abort the shutdown. This example
would cause the machine to go into standby mode.
<Shutdown Cmd="standby" Type="standby"/>
Note that MCE Controller has no way of causing a machine to
"wake up". You can use Wake-On-LAN (WOL) to do this. You'll
need to figure out a way to send the "WOL" magic packet from
your control system to the MAC address of the Ethernet
adapter in your MCE PC.
command sets the specified window (using the window�s class name) to the
For example, the following makes
the foreground Window (assuming
You can also edit
to change the text string associated with a particular command.
Future Version Ideas
Below is a list of some of the things I�m considering adding
to MCE Controller in the future. If you like these ideas, or have others that
you�d like to see implemented, please send me email or post feedback on the MCE
Windows MCE supports a technology that allows external applications to be
notified of state changes within MCE. For example, what music track is
currently playing, or what channel on live TV is currently active. MCE
Controller could be enhanced to support relaying this state information over
the network to other devices.
MCE Controller currently has about 20% the functionality of Girder. Given the
current architectural model of MCE Controller, I could easily extend it to
support much of what Girder can do such as scripting, supporting other input
and output mechanisms, etc� I�ve toyed with the idea of turning MCE Controller
into a Girder alternative for general purpose AV device integration.
An installation program.
Security. Right now there is no security on the port that MCE Controller opens
when in server mode. If you are concerned about this you can use MCE Controller
in client mode. I�ve considered adding security, however one of the reasons I
wrote MCE Controller was that Girder�s
functionality requires the use of a security mechanism which makes it very hard
to use from a control system such as Crestron�
Version 1.0.1 (February 22, 2004) � First publicly released version.
Verison 1.0.2 (March 24, 2004) - New features:
Added support for system shutdown, restart, standby, and hibernate (the
Renamed a few commands ("mce_start" is now "mcestart"
for example) to be more consistent.