Click here to Skip to main content
14,365,424 members

Remote Assistance in Windows 7 Using C#.NET

Rate this:
4.00 (1 vote)
Please Sign up or sign in to vote.
4.00 (1 vote)
23 Jan 2015CPOL
Remote Assistance using the MSRA EXE and its arguments

Introduction

Here, I have designed a class and a form, and it gives you the following functionalities:

  1. Offer Remote Assistance to a Machine
  2. Ask for Remote Help (Invite someone to help you)

Design a form with the following controls:

  1. Textbox for taking the IP or computer name to Connect
  2. Button 1. To connect to the Remote Machine for offering Remote Assistance
  3. Button 2. To ask or invite someone to help

Image 1

Code behind in the Form is as given below:

private void btnConnect_Click(object sender, EventArgs e)
        {
            RemoteConnect remoteConnect = new RemoteConnect();
            Boolean status;
			status = remoteConnect.StartRemoteAssistance
					(txtComputerName.Text.ToString(), true, false);
            System.Windows.Forms.MessageBox.Show(status.ToString());
        }

			private void BtnInvite_Click(object sender, EventArgs e)
        {
            RemoteConnect remoteConnect = new RemoteConnect();
            Boolean status;
            status = remoteConnect.StartRemoteAssistance
			(txtComputerName.Text.ToString(), false, true);
        }

We have two buttons here and they are sending the Boolean variable to the class function for differentiating between Offer Help and Ask for Help.

Code under the Class File: RemoteConnect is as follows:

namespace RemoteAssist
{
    class RemoteConnect
    {
	public Boolean StartRemoteAssistance
		(String strMachinename, Boolean offerHelp, Boolean askForHelp)
        {            
	System.Diagnostics.Process process = new System.Diagnostics.Process();

	System.Diagnostics.ProcessStartInfo startInfo = 
				new System.Diagnostics.ProcessStartInfo();
	startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;            
            startInfo.FileName = "msra.exe";

            // Offer Remote Assistance 
            if (offerHelp == true)
            {
                startInfo.Arguments = "/offerRA " + strMachinename;
            }

            //ASK for Remote Assistance
            if (askForHelp == true)
            {
                startInfo.Arguments = "novice";
            }

            try
            {
                process.StartInfo = startInfo;
                process.Start();
                return true;
            }

            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show
                ("Error Occurred while processing Remote Assistance" + ex.Message);
                return false;
            }       
        }
    }
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

py.Net.JS
Software Developer (Senior) Allianz
India India
A simple human being loves my small world. I just enjoy learning new skills and taking on new challenges. I have 9+ years experience in IT.

Got my skill sets in ASP.Net, MVC, Angular JS, Oracle , SQL Server and VB6 and I am keeping an eye on the future technologies that pops around the IT world!

Comments and Discussions

 
-- There are no messages in this forum --
Tip/Trick
Posted 23 Jan 2015

Tagged as

Stats

10.1K views
6 bookmarked