Skip to content

Instantly share code, notes, and snippets.

@pegasuskim
Created June 9, 2016 06:41
Show Gist options
  • Save pegasuskim/eaf60123af1adab1742394b02e17b34d to your computer and use it in GitHub Desktop.
Save pegasuskim/eaf60123af1adab1742394b02e17b34d to your computer and use it in GitHub Desktop.
using System.Runtime.InteropServices;
using RDPCOMAPILib;
RDPSession currentSession = new RDPSession();
public static void RDPConnect()
{
if(currentSession != null)
{
currentSession.OnAttendeeConnected += Incoming;
currentSession.Open();
}
}
public static void RDPDisconnect()
{
if (currentSession != null)
{
currentSession.Close();
Marshal.ReleaseComObject(currentSession);
currentSession = null;
// 가비지 컬렉터 호출 해서 메모리 회수
GC.Collect();
}
}
public static string ConnectionString(String authString, string group, string password, int clientLimit)
{
invitation = currentSession.Invitations.CreateInvitation(authString, group, password, clientLimit);
return invitation.ConnectionString;
}
private static void Incoming(object Guest)
{
IRDPSRAPIAttendee MyGuest = (IRDPSRAPIAttendee)Guest;
// CTRL_LEVEL_VIEW 지정
MyGuest.ControlLevel = CTRL_LEVEL.CTRL_LEVEL_VIEW;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment