无论如何,对RDPSession的COMException E_UNEXPECTED

时间:2012-05-15 17:54:25

标签: c# windows sharing rdp

我正在尝试根据找到的here说明和找到的文档HEREHERE制作一个屏幕共享应用程序。但是,这是一个主题,关于哪个信息不存在,文档很少。

这是我正在使用的代码片段。这是在我的会话(服务器)方面,所以将它的桌面分享给客户端。

private void Form1_Load(object sender, EventArgs e)
    {
        session.OnAttendeeConnected += session_OnAttendeeConnected;
        session.Open();

        IRDPSRAPIInvitation invitation = session.Invitations.CreateInvitation(null, "test", "", 10);
        invitationTextBox.Text = invitation.ConnectionString;
        log.Debug("Created invitation: " + invitation.ConnectionString);
    }

    void session_OnAttendeeConnected(object pAttendee)
    {
        IRDPSRAPIAttendee attendee = pAttendee as IRDPSRAPIAttendee;
        attendee.ControlLevel = CTRL_LEVEL.CTRL_LEVEL_INTERACTIVE;
        log.Info("Attendee Connected from " + attendee.RemoteName);
    }

    private void requestColourDepth(object sender, EventArgs e)
    {
        session.Pause();

        if (eightBitRadio.Checked)
        {
            session.colordepth = 8;
        }
        else if (sixteenBitRadio.Checked)
        {
            session.colordepth = 16;
        }
        else if (twentyfourBitRadio.Checked)
        {
            session.colordepth = 24;
        }
        else
        {
            session.colordepth = 32;
        }

        session.Resume();
    }

我的问题是Form1_Load之外的任何尝试与会话对象sems交互的内容都会导致以下异常:

        base    {"Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"}    System.Runtime.InteropServices.ExternalException {System.Runtime.InteropServices.COMException}
        ErrorCode   -2147418113 int

我不相信这是我的代码完全错误,我相信某些东西不能在处理COM的地方正确加载,但我没有太多使用COM对象的经验并且可以使用某些方向。

谢谢!

0 个答案:

没有答案
相关问题