使用c#dot net进行桌面共享 [英] desktop sharing using c# dot net
本文介绍了使用c#dot net进行桌面共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using RDPCOMAPILib;
namespace ScrS_server_
{
public partial class Form1 : Form
{
RDPSession x = new RDPSession();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Incoming(object Guest)
{
IRDPSRAPIAttendee MyGuest = (IRDPSRAPIAttendee)Guest;//???
MyGuest.ControlLevel = CTRL_LEVEL.CTRL_LEVEL_INTERACTIVE;
}
private void button1_Click(object sender, EventArgs e)
{
x.OnAttendeeConnected += Incoming;
x.Open();
}
private void button2_Click(object sender, EventArgs e)
{
IRDPSRAPIInvitation Invitation = x.Invitations.CreateInvitation("Trial", "MyGroup", "", 10);
textBox1.Text = Invitation.ConnectionString;
}
private void button3_Click(object sender, EventArgs e)
{
x.Close();
x = null;
}
}
}
它会给以下错误: -
检索具有CLSID {9B78F0E6-3E05-4A5B-B2E8-E743A8956B65}的组件的COM类工厂由于以下错误而失败:80040154。
推荐答案
这是类未注册错误。检查您的注册表以确保列出错误消息中引用的CLSID。
That's a "class is not registered" error. Check your registry to make sure that the CLSID cited in the error message is listed.
gf h gf f fg fj gf
gf h gf f fg fj gf
当exec关闭事件时,添加
Marshal.ReleaseComObject(x)
例如:
private void button3_Click(object sender,EventArgs e)
{
//释放com
Marshal.ReleaseComObject(x);
//x.Close();
x = null;
}
Just when exec close event, add
Marshal.ReleaseComObject(x)
for example:
private void button3_Click(object sender, EventArgs e)
{
//release com
Marshal.ReleaseComObject(x);
//x.Close();
x = null;
}
这篇关于使用c#dot net进行桌面共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文