MCE Controller v1.0.1 Released!

Today I released the first public version of MCE Controller.

MCE Controller allows the Media Center application of Windows Media Center Edition (MCE) to be integrated into an advanced AV 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 MCE Controller receives the string “mypictures” it will tell Media Center to go to the “My Pictures” page.


I wrote MCE Controller so I could better integrate MCE into my Crestron whole-house audio/video system. I originally was using IR blasting to control MCE from Creston, but had reliability problems and wanted something more robust. I then tried using Girder (www.girder.nl) and was able to cobble together a solution using Girder’s iserver TCP/IP functionality. However Girder’s iserver add-in requires an MD5 hash for authentication and it was too much a pain to implement in Crestron’s SIMPL system.


Plus, I really wanted to get my hands dirty and write a C# app. See http://kindel.com/blogs/charlie/posts/212.aspx.


I spent too much time while on vacation skiing in Colorado hacking this app together (on the plane and at night). But it was fun. In the end I’ve produced what I think might be a very useful app for people trying to integrate MCE into their home control systems. In fact, MCE Controller may be useful for anyone trying to integrate any PC based application into such a system. The app is general enough that it can be utilized from any control system that supports sending text strings to a TCP/IP port.


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.


So here it is: http://www.kindel.com/products/mcecontroller. I’d love to hear any feedback people have.

© Charlie Kindel. All Rights Reserved.

20 comments


  1. http://

    I am trying to write a telnet programm to comunicate with MCE Controler.

    This program is written in VB.Net 2003.

    The problem is this programm only works once then I have to start the WindowsXP telnet programm again and it works only once ;-(

    Maybe someone has some advice?

    The code is VB.Net just add an RichTextbox, Textbox and 2 buttons to the form and then put in the underneath code:

    Imports System.Net.Sockets

    Imports System

    Imports System.Net

    Imports System.Text

    Imports System.Collections

    Public Class Form1

    Inherits System.Windows.Forms.Form

    Dim sock1 As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)

    #Region " Windows Form Designer generated code "

    Public Sub New()

    MyBase.New()

    ‘This call is required by the Windows Form Designer.

    InitializeComponent()

    ‘Add any initialization after the InitializeComponent() call

    End Sub

    ‘Form overrides dispose to clean up the component list.

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

    If disposing Then

    If Not (components Is Nothing) Then

    components.Dispose()

    End If

    End If

    MyBase.Dispose(disposing)

    End Sub

    ‘Required by the Windows Form Designer

    Private components As System.ComponentModel.IContainer

    ‘NOTE: The following procedure is required by the Windows Form Designer

    ‘It can be modified using the Windows Form Designer.

    ‘Do not modify it using the code editor.

    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox

    Friend WithEvents Button1 As System.Windows.Forms.Button

    Friend WithEvents Button2 As System.Windows.Forms.Button

    Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox

    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    Me.TextBox1 = New System.Windows.Forms.TextBox

    Me.Button1 = New System.Windows.Forms.Button

    Me.Button2 = New System.Windows.Forms.Button

    Me.RichTextBox1 = New System.Windows.Forms.RichTextBox

    Me.SuspendLayout()



    ‘TextBox1



    Me.TextBox1.Location = New System.Drawing.Point(40, 88)

    Me.TextBox1.Name = "TextBox1"

    Me.TextBox1.Size = New System.Drawing.Size(176, 20)

    Me.TextBox1.TabIndex = 0

    Me.TextBox1.Text = "TextBox1"



    ‘Button1



    Me.Button1.Location = New System.Drawing.Point(24, 144)

    Me.Button1.Name = "Button1"

    Me.Button1.Size = New System.Drawing.Size(88, 32)

    Me.Button1.TabIndex = 1

    Me.Button1.Text = "Send"



    ‘Button2



    Me.Button2.Location = New System.Drawing.Point(144, 144)

    Me.Button2.Name = "Button2"

    Me.Button2.Size = New System.Drawing.Size(88, 32)

    Me.Button2.TabIndex = 2

    Me.Button2.Text = "Connect"



    ‘RichTextBox1



    Me.RichTextBox1.Location = New System.Drawing.Point(40, 8)

    Me.RichTextBox1.Name = "RichTextBox1"

    Me.RichTextBox1.Size = New System.Drawing.Size(192, 72)

    Me.RichTextBox1.TabIndex = 3

    Me.RichTextBox1.Text = "RichTextBox1"



    ‘Form1



    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

    Me.ClientSize = New System.Drawing.Size(292, 266)

    Me.Controls.Add(Me.RichTextBox1)

    Me.Controls.Add(Me.Button2)

    Me.Controls.Add(Me.Button1)

    Me.Controls.Add(Me.TextBox1)

    Me.Name = "Form1"

    Me.Text = "Form1"

    Me.ResumeLayout(False)

    End Sub

    #End Region

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

    ‘This is the connect button

    Connect()

    Button2.Enabled = False

    ‘Receive()

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    ‘This is the send button

    Send()

    TextBox1.Text = ""

    ‘Receive()

    End Sub

    Private Function Connect()

    ‘BAD connection example = 206.245.158.190 5000

    ‘GOOD connection example = 63.205.237.177 1912

    Dim myIP As IPAddress = IPAddress.Parse("192.168.0.2")

    ‘Parse the port number from the end of the string in the combobox

    Dim EPhost As New IPEndPoint(myIP, 5150)

    ‘Catch errors trying to connect to hosts that may not be there

    Try

    sock1.Connect(EPhost)

    Catch ex As Exception

    RichTextBox1.Text += ControlChars.CrLf & "ERROR: " & ex.Message

    End Try

    End Function

    Function Receive()

    Dim scanstring As String

    Dim buffer(32000) As Byte

    Dim ttlbytes As Integer

    Dim x As Integer

    sock1.Blocking = False

    For x = 1 To 1000

    Try

    ttlbytes = sock1.Receive(buffer, buffer.Length, 0)

    Catch ex As Exception

    ‘RichTextBox1.Text += "ERROR: " & ex.Message

    End Try

    ‘Convert this received message from a byte array to an easier to use string

    If ttlbytes > 0 Then

    scanstring = System.Text.Encoding.ASCII.GetString(buffer, 0, ttlbytes)

    RichTextBox1.Text += scanstring

    ttlbytes = 0

    End If

    Next x

    End Function

    Public Sub Send()

    Dim i As Integer

    Try

    ‘// Send the Message

    Dim messageText As String = TextBox1.Text + ControlChars.CrLf

    Dim sendMessage(messageText.Length) As Byte ‘= New Byte()

    For i = 1 To messageText.Length

    sendMessage(i – 1) = Convert.ToByte(Asc(Mid(messageText, i, 1)))

    Next

    sock1.Send(sendMessage, sendMessage.Length, SocketFlags.None)

    Catch e As Exception

    RichTextBox1.Text += ControlChars.CrLf & "ERROR: " & e.Message

    End Try

    End Sub

    End Class

  2. http://

    Got it running posted the code on the Greenbutton

  3. http://

    Very nice. How did you manage to send the Windows Key?

  4. http://

    I use SendInput and use the VK_LWIN vk code. VK_LWIN and VK_RWIN act like ctrl, shift, and alt in that my code "holds them down" if you specify true in the command in the .commands file.

  5. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  6. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  7. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  8. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  9. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  10. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  11. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  12. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  13. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  14. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  15. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  16. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  17. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  18. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  19. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

  20. http://

    Please call me at 810.629.5369 – Mark Taubits/General Foreman

Leave a Reply

Your email address will not be published. Required fields are marked *