简体   繁体   中英

Disconnect a Remote Desktop session programmatically

如何在C#或C ++应用程序中以编程方式断开远程桌面会话的连接?

您可以尝试运行tsdiscon: http : //support.microsoft.com/kb/321705

You can use the following code in C# to fetch the remote desktop connection pid by using its name and then kill

   Process[] my = Process.GetProcessesByName("mstsc");
   int pid = my[0].Id;
   Process pro = Process.GetProcessById(pid);
   pro.Kill();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM