且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

程序在Windows 10上共享屏幕问题

更新时间:2023-02-01 17:33:13

您好NewSofyXA,


感谢您在此发帖。


对于您的问题,您可以尝试做出判断。如果Windows系统是Win10,它将返回true,并使用Win7中的不同字符。

 static bool IsWindows10()
{
var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE \ Microoft \ Windows NT \ CurrentVersion");

string productName =(string)reg.GetValue(" ProductName");

返回productName.StartsWith(" Windows 10");
}

我测试代码。如果我在Win10中运行,则返回true,否则返回false(我在Win7中测试)。


***的问候,


Wendy


Hi,

We implement a screen sharing tool using RDPCOMAPILIB.dll, which include two applications host and viewer. The viewer connect to the host by axRDPViewer.Connect(viewerTicket, myName, "");


The argument viewerTicket is sent by tcp message, and myName is combined with two strings "name" and "id", which separator character is "\f"(Form Feed 0x0c), so the value may like this "myViewer\f14".


It works well on Windows 7, when we try both host and viewer on Windows 10(RS3), the result are different, if the "name" include more than 8 characters it works, otherwise it pops an error message "Your remote desktop connection failed because the remote computer cannot be authenticated" and failed.


for compatible with earlier application, it is hard to modify the arguments.

Can you teach me where is the problem, How can we take care of it?

Hi NewSofyXA,

Thank you for posting here.

For your question, you could try make a judgement. If the Windows system is Win10, it will return true, and use the different characters with Win7.

static bool IsWindows10()
        {
            var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");

            string productName = (string)reg.GetValue("ProductName");

            return productName.StartsWith("Windows 10");
        }

I test the code. If I run in Win10, it return true, otherwise, return false (I test in Win7).

Best Regards,

Wendy