简体   繁体   English

点网提供远程协助

[英]Dot Net Offer Remote Assistance

I have been attempting to use the Unsolicited Offer Remote Assistance function built into windows within my application for months now with no success. 几个月来,我一直在尝试使用应用程序内Windows内置的主动提供的远程协助功能,但没有成功。

to be clear, this is exactly thesame functionality as msra /offerRA computername. 需要明确的是,这与msra / offerRA计算机名完全相同。 where a Expert can Offer remote assistance to the novice without the novice having to create a ticketstring manually. 专家可以为新手提供远程帮助,而新手不必手动创建票证。 As far as i am aware this is accomplished using DCOM to communicate information using RAserver and then MSRA takes over for the actual connection. 据我所知,这是使用DCOM通过RAserver传达信息来完成的,然后MSRA接管了实际的连接。 I have confirmed that i can use MSRA /OfferRA ComputerName so the functionlity is there. 我已经确认我可以使用MSRA / OfferRA ComputerName,所以功能就在那里。

I have tried many API/DLL's and i still cannot figure out how to offer remote assistence in OFFERRA 我已经尝试了许多API / DLL,但仍然不知道如何在OFFERRA中提供远程支持

I have trie the following modules. 我尝试了以下模块。 AxRDPCOMAPILib RDPCOMAPILib RAServerLib RendezvousSessionLib AxRDPCOMAPILib RDPCOMAPILib RAServerLib RendezvousSessionLib

i have tried so many different variations of code its not possible to post them all up here. 我尝试了许多不同的代码变体,无法将它们全部张贴在这里。 i need some help to know how to use the OfferRA functionality using Windows Remote Assistance. 我需要一些帮助,以了解如何使用Windows远程协助来使用OfferRA功能。 I DO NOT want to crate a peer to peer application. 我不想创建对等应用程序。 i would like my application to connect to remote assistance on the client computer using the MSRA that is installed on their computer from Microsoft. 我希望我的应用程序使用从Microsoft安装在客户端计算机上的MSRA连接到客户端计算机上的远程协助。

Any help would be appreciated. 任何帮助,将不胜感激。

Attempted Code1: 尝试的代码1:

        AxRDPViewer Viewer = new AxRDPViewer();
        Viewer.BeginInit();
        Viewer.SuspendLayout();
        RemoteAssistanceWindow.Child = Viewer;
        Viewer.ResumeLayout();
        Viewer.EndInit();
        ((AxRDPViewer)RemoteAssistanceWindow.Child).Connect("DZ0006", "MySecretUsername", "MySecretPassword");

Results: 结果:

A first chance exception of type 'System.ArgumentException' occurred in AxRDPCOMAPILib.dll 类型'System.ArgumentException'的第一次机会异常发生在AxRDPCOMAPILib.dll中

The program '[4936] Enterprise.vshost.exe: Program Trace' has exited with code 0 (0x0). 程序“ [4936] Enterprise.vshost.exe:程序跟踪”已退出,代码为0(0x0)。

The program '[4936] Enterprise.vshost.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'. 程序“ [4936] Enterprise.vshost.exe”已退出,代码为-1073741819(0xc0000005)“访问冲突”。

Update 2: 更新2:

        RDPViewer Viewer = new RDPViewer();
        IMRequestRA Request = new IMRequestRA();
        Request.SetRendezvousSession(Viewer);

The thread 0x1c60 has exited with code 259 (0x103). 线程0x1c60已退出,代码为259(0x103)。

The program '[7520] Enterprise.vshost.exe: Program Trace' has exited with code 0 (0x0). 程序“ [7520] Enterprise.vshost.exe:程序跟踪”已退出,代码为0(0x0)。

The program '[7520] Enterprise.vshost.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'. 程序“ [7520] Enterprise.vshost.exe”已退出,代码为-1073741819(0xc0000005)“访问冲突”。

Remote Assistance using the MSRA Exe and its arguments. 使用MSRA Exe及其参数的远程协助。

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 用于获取IP或计算机名称进行连接的文本框
  2. Button 1. To connect to the Remote Machine for offering Remote Assistance 按钮1.连接到远程机器以提供远程协助
  3. Button 2. To Ask or invite someone to help. 按钮2.询问或邀请某人提供帮助。

Code Behind in the Form: 表单中的代码背后:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace RemoteAssist
{
    public partial class FrmConnect : Form
    {
        public FrmConnect()
        {
            InitializeComponent();
        }

     private void btnConnect_Click(object sender, EventArgs e)
        {
            RemoteConnect remoteConnect = new RemoteConnect();
            Boolean status = remoteConnect.StartRemoteAssistance(txtComputerName.Text.ToString(), true,false);
            if (status == false)
            {
System.Windows.Forms.MessageBox.Show("Unable to Connect to the Remote Machine.Please try Again later.");
            }
        }

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

            if (status == false)
            {
                System.Windows.Forms.MessageBox.Show("Unable to Establish Connection, Please try Again later.");
            }
        }

        private void FrmConnect_Load(object sender, EventArgs e)
        {
        }

        private void txtComputerName_TextChanged(object sender, EventArgs e)
        {
            txtComputerName.CharacterCasing = CharacterCasing.Upper;
        }             
    }
}

We have two buttons here and they are sending the Boolean variable to the class function for differentiating between offer Help and Asking for Help. 我们这里有两个按钮,它们将Boolean变量发送给class函数,以区分商品帮助和寻求帮助。

Code under the Class File : RemoteConnect 类文件下的代码:RemoteConnect

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

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 Assitance 
            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 Occured while trying to Connect" + ex.Message);
                return false;
            }           
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM