Click here to Skip to main content
13,250,043 members (64,578 online)
Click here to Skip to main content
Add your own
alternative version


48 bookmarked
Posted 1 Jul 2004

Remote Controlled Windows Application

, 1 Jul 2004
Rate this:
Please Sign up or sign in to vote.
How to let your Windows application be remote controlled


This small Windows application shows how to make your application or part of it be controlled from remote machines. The demo application just can flip an image and this is also what several remote clients can do.


Since most of the samples I found on Internet about remoting do let the .Net runtime create the marshalled object in the hidden background,
I had to find a way to create and marshal my objects programmatically to provide it with a reference to my applications interface. This is just what my application demonstrates.

It also demonstrates how to minimize the dependencies from server and clients by accessing the remote object over interfaces. Here is the design pattern for decoupling the objects with interfaces.

Using the code

The VS-Solution 'MyRemoteSampleApp.sln' holds the 3 projects: the application, the client and the remotable class.

  • MyServerApplication
  • MyClient
  • MyRemoteInterface

After starting 'MyServerApplication.exe' you can start as many clients 'MyClient.exe' as you like, which all connect to the same 'MyService' object.

Points of Interest

Create and marshal the object on server side in the applications 'Main()':

TcpChannel channel = new TcpChannel(8080);

// Create a single marshalled object
MyServiceClass remService  = new MyServiceClass();
ObjRef obj = RemotingServices.Marshal(remService,"TcpService");

// Create appllications MainForm
MainAppForm frmMain = new MainAppForm();

// provide the marshalled object with a reference to the Applications interface
remService.theMainForm = ( IAppRemote) frmMain;

// start application
Connect to the remote object on client side:
// Interface reference
IMyService remServive = null;

// Get a TCP channel and register required service
ChannelServices.RegisterChannel(new TcpChannel());
WellKnownClientTypeEntry remotetype = new WellKnownClientTypeEntry(

// instantiates the proxy
remServive = new MyServiceClass();


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Joel Brandenberger
Switzerland Switzerland
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralIdle Time Pin
HMJ25-Jul-04 8:34
memberHMJ25-Jul-04 8:34 
GeneralRe: Idle Time Pin
jobr1ch25-Jul-04 21:31
memberjobr1ch25-Jul-04 21:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171114.1 | Last Updated 2 Jul 2004
Article Copyright 2004 by Joel Brandenberger
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid