如何以编程方式检测是否存在远程桌面会话? [英] How to detect if a remote desktop session is present programatically?
本文介绍了如何以编程方式检测是否存在远程桌面会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要知道我的应用程序是否在远程桌面/连接会话下运行.我该怎么办?
感谢forward
I need to know if my application is running under a remote desktop/connection session. How can I di it?
Thanks in forward
推荐答案
我知道您要求使用本机C ++,但是.NET具有SystemInformation.TerminalServerSession
.最坏的情况是您可以编写一个精简的C ++/CLI DLL来将这个值返回给您.
http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation.terminalserversession.aspx [ ^ ]
[更新]
----------
抱歉,您根本不需要使用.NET.
请参阅 http://msdn.microsoft.com/en-us/library/aa380798(v = vs.85).aspx [
I know you asked for native C++, but .NET hasSystemInformation.TerminalServerSession
. Worst case you could write a thin C++/CLI DLL that returns this value to you.
http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation.terminalserversession.aspx[^]
[Update]
----------
Sorry, but you don''t need to use .NET at all.
See http://msdn.microsoft.com/en-us/library/aa380798(v=vs.85).aspx[^]
Code snippet from that link:
#include <windows.h>
#pragma comment(lib, "user32.lib")
BOOL IsRemoteSession(void)
{
return GetSystemMetrics( SM_REMOTESESSION );
}
这篇关于如何以编程方式检测是否存在远程桌面会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文