Introduction
Here, I have designed a class and a form, and it gives you the following functionalities:
- Offer Remote Assistance to a Machine
- Ask for Remote Help (Invite someone to help you)
Design a form with the following controls:
- Textbox for taking the IP or computer name to Connect
- Button 1. To connect to the Remote Machine for offering Remote Assistance
- Button 2. To ask or invite someone to help
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";
if (offerHelp == true)
{
startInfo.Arguments = "/offerRA " + strMachinename;
}
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;
}
}
}
}
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!