Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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;

        }

    }
}


It will give the following error:-
Retrieving the COM class factory for component with CLSID {9B78F0E6-3E05-4A5B-B2E8-E743A8956B65} failed due to the following error: 80040154.
Posted
Updated 7-Feb-11 1:26am
v2
Comments
Michael Bookatz 7-Feb-11 7:28am    
What does RDPCOMAPILib do? You are importing something but can't see it n your code so may be in RDPCOMAPILib
#realJSOP 7-Feb-11 12:48pm    
It's a remote desktop process library. Google it, and you'll get a much more complete answer than I feel like providing on my own.

That's a "class is not registered" error. Check your registry to make sure that the CLSID cited in the error message is listed.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 7-Feb-11 12:45pm    
A 5,
--SA
dschakel 18-Apr-11 22:53pm    
I get a similar error using the VB version of the above code.
And yes, the CLSID is in the registry.
Creating an instance of the COM component with CLSID {9B78F0E6-3E05-4A5B-B2E8-E743A8956B65} from the IClassFactory failed due to the following error: 800700b7
Namely, the first time through all works as expected, however, the second time around the code is called the above error occurs. And, also, I have checked that all of the variables have been released, even going as far as putting everything on a new form and destroying the form before trying again.
When the application is exited, everything works as advertised.
Sumit Prakash Sharma 25-Apr-14 3:54am    
how can i register this class in Registry
gf h gf f fg fj gf
 
Share this answer
 
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;

}
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900