View Full Version : remote desktop from inside NR

April 11th, 2004, 06:56 AM
Just a tip (for win32 users) :

If your home theatre/JRMC/Girder PC uses XP, then it has a stripped down version of terminal server on board (called remote assistance, only one client can be active)

You can take over the desktop of that pc from another pc using any terminal server client.
On an xp machine, you can use the mstsc.exe program pre-installed in the windows\system32 directory.

There is also an active-x control terminal server client available, meant for use in web pages.
But it also works directly from netremote :

the ocx can be downloaded here (first check if it isn't already installed !!)


After installation, double click on C:\Inetpub\wwwroot\TSWeb\default.htm
a popup should appear asking you to install the ocx.

then in tonto create a button called NRREMOTE (or whatever)

IR action

5001 0000 0000 0002 fc19 0000 0031 0000

change the ip address to your server name and user name to whatever is required. You still need to type in the password to log in....

Note that there is only ONE IR action where you have to put each item on a different line. (press ENTER, not OK)

Also Note, that for some reason, if the focus is lost from the ocx (e.g. by clicking on some NR button on the same page or switching to another application) that the mouse/keyboard stops working inside the ocx. (exit the panel with the ocx and enter it again to get going again...)

To automatically log on, you would have to do something like :

NRREMOTE.AdvancedSettings2.ClearTextPassword:= BSTR(secret)

BUT, only base variable types are supported, so this doesn't work in NR (AdvancedSettings2 is of type IMsRdpClientAdvancedSettings)
Correct me if I am wrong here, Ben :D

I created a simple wrapper OCX, that supports auto login by allowing :
NRREMOTE.ClearTextPassword:= BSTR(secret)
instead of :
NRREMOTE.AdvancedSettings2.ClearTextPassword:= BSTR(secret)

Option Explicit

Private Const m_def_UserName = ""
Private Const m_def_Server = ""
Private Const m_def_ClearTextPassword = ""

Private m_UserName As String
Private m_Server As String
Private m_ClearTextPassword As String

Private Sub UserControl_Initialize&#40;&#41;
MsRdpClient1.Top = 0
MsRdpClient1.Left = 0
End Sub

Private Sub UserControl_Resize&#40;&#41;
MsRdpClient1.Width = Width
MsRdpClient1.Height = Height
End Sub

Private Sub UserControl_InitProperties&#40;&#41;
m_UserName = m_def_UserName
m_Server = m_def_Server
m_ClearTextPassword = m_def_ClearTextPassword
End Sub

Private Sub UserControl_ReadProperties&#40;PropBag As PropertyBag&#41;
m_UserName = PropBag.ReadProperty&#40;"UserName", m_def_UserName&#41;
m_Server = PropBag.ReadProperty&#40;"Server", m_def_Server&#41;
m_ClearTextPassword = PropBag.ReadProperty&#40;"ClearTextPassword", m_def_ClearTextPassword&#41;
End Sub

Private Sub UserControl_WriteProperties&#40;PropBag As PropertyBag&#41;
PropBag.WriteProperty "UserName", m_UserName, m_def_UserName
PropBag.WriteProperty "Server", m_Server, m_def_Server
PropBag.WriteProperty "ClearTextPassword", m_ClearTextPassword, m_def_ClearTextPassword
End Sub

Public Property Get UserName&#40;&#41; As String
UserName = m_UserName
End Property

Public Property Let UserName&#40;ByVal New_UserName As String&#41;
m_UserName = New_UserName
PropertyChanged "UserName"
End Property

Public Property Get Server&#40;&#41; As String
Server = m_Server
End Property

Public Property Let Server&#40;ByVal New_Server As String&#41;
m_Server = New_Server
PropertyChanged "Server"
End Property

Public Property Get ClearTextPassword&#40;&#41; As String
ClearTextPassword = m_ClearTextPassword
End Property

Public Property Let ClearTextPassword&#40;ByVal New_ClearTextPassword As String&#41;
m_ClearTextPassword = New_ClearTextPassword
PropertyChanged "ClearTextPassword"
End Property

Public Sub Connect&#40;&#41;
On Error Resume Next
MsRdpClient1.SecuredSettings.AudioRedirectionMode = 1 ' play sounds at the remote computer
MsRdpClient1.SecuredSettings.KeyboardHookMode = 2 'Only apply key combinations to the remote server when the client is running in full screen mode
MsRdpClient1.Server = m_Server
MsRdpClient1.UserName = m_UserName
MsRdpClient1.AdvancedSettings2.ClearTextPassword = ClearTextPassword
End Sub

Public Sub Disconnect&#40;&#41;
On Error Resume Next
End Sub


Ben S
April 11th, 2004, 06:54 PM
How do you do it? You could make NetRemote 2.0 just by playing with and writing your ocx's. Nice job!

Have you gotten streaming audio to NetRemote via the WMP com object working yet? I know Gavin had it working via a web browser "stub", but directly would be nice.

And then NetRemote could send commands to the stream server to control the streams. Nice!

April 11th, 2004, 09:36 PM
You could enhance this in two possible ways...

1) Use Remote Desktop and force using a specific user which is setup to ONLY be able to run Media Center. The app will load automatically and is the only thing that can be run by that user.
- Do this using Policies in WinXP so that immediately once the user logs in, MC is ran and you cannot do anything else. This would add a bit of security.

2) *less secure* - have the RDP client automatically run MC upon login. Not sure if the WinCE client supports this.

April 14th, 2004, 12:45 AM
Do you think you could build an OCX that would work for the SimPad (WinCE.net 4.0 & 4.1)?

April 14th, 2004, 03:01 AM
Do you think you could build an OCX that would work for the SimPad (WinCE.net 4.0 & 4.1)?

sorry no...

I use a tabletpc for my NR...

I use visual basic to develop simple OCX's and they won't work on windows ce....



Ben S
April 20th, 2004, 07:52 AM
It's unfortunate that the RDP client on the Simpad is so poor. I find it unusable with the fact that it doesn't save your information properly (you need to type it in each time), you cannot use the virtual keyboard, and if you turn the Simpad off and then back on you cannot "resume", you need to type all the info in again, etc.

But regarding this stuff - Cool! If I create an "OCX" type for user uploads, can you upload some of these objects? I don't have VB installed, unfortunately, so cannot compile them.

April 20th, 2004, 08:14 AM
Hi Ben,

I can mail you a bunch of zip files with the source code/ocx in them...

just the ocx on it's own.. is probably not very useful....

So far, noone has been interested in my ocx's anyway because 99.9% of the NR users seem to use windows CE and I use win32...

The reason why I have only published the code on this forum (com thread) and not the ocx's themselves is that if other people modify my ocx's and don't change to a different GUID, then all kinds of conflicts/incompatibilities will happen....

note that I still have issues with some of my ocx's..
that is another reason why I haven't published them....

* unloading the remote desktop wrapper ocx sometimes crashes NR..

* the 2 alpha blended ocx's aren't quite working as I want... (waiting for an on-page-load ir action to fix this)

do you still want all my ocx's ?


Ben S
April 20th, 2004, 08:25 AM
I guess not yet.

Lets get this working a bit better, and then we'll be good to rock and roll.