Creating RDP in a C # Application

I am currently trying to create RDP in the application that I created. We constantly need to regularly connect to many servers and would like to get rid of the need to inform our employees about the details on all servers.

I am currently trying to use this example: http://www.codeproject.com/KB/cs/RemoteDesktop_CSharpNET.aspx

When using the above, I get the following error:

Getting the factory COM class for a component with CLSID {791FA017-2DE3-492E-ACC5-53C67A2B94D0} failed due to the following error: 80040154 The class was not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

From this code:

MsRdpClient rdp1; rdp1 = new MSTSCLib.MsRdpClient(); 

Any help would be greatly appreciated, thanks.

+4
source share
2 answers

Define the Visual Studio project as an x86 assembly.

Project Properties → Creation Tab → Platform Target → x86

enter image description here

If this does not help, try registering com dll through regsvr32 .

+1
source

As iamsleepy commented, depending on your OS, you need another COM component.

The one you specified is for XP. Take a look at the following page for all CLSIDs for different operating systems:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa383541%28v=vs.85%29.aspx

For example, for Windows 7 you need {A9D7038D-B5ED-472E-9C47-94BEA90A5910} , which when searching the registry (HKEY_CLASS_ROOT \ CLSID) provides C:\Windows\System32\mstscax.dll

0
source

All Articles