Winapi Win32 BlockInput不支持';从xp远程处理到xp时无法解锁
我有一个在C#中调用Win32 BlockInput函数的脚本,如下所示:Winapi Win32 BlockInput不支持';从xp远程处理到xp时无法解锁,winapi,c#-4.0,remote-desktop,Winapi,C# 4.0,Remote Desktop,我有一个在C#中调用Win32 BlockInput函数的脚本,如下所示: public partial class NativeMethods { /// Return Type: BOOL->int ///fBlockIt: BOOL->int [System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint = "BlockIn
public partial class NativeMethods
{
/// Return Type: BOOL->int
///fBlockIt: BOOL->int
[System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint = "BlockInput")]
[return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]
public static extern bool BlockInput([System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] bool fBlockIt);
}
public static void toggleMouseAndKeyboard(bool flag)
{
try
{
NativeMethods.BlockInput(flag);
}
catch(Exception ex)
{
throw new Exception(ex.Message);
}
}
无论何时我在本地运行脚本,无论是Windows7还是WindowsXP,这都非常有效。我也可以按CTRL+ALT+DEL来解锁机器
当我将Windows 7计算机远程连接到Windows XP或Windows 7远程连接到Windows 7时,这也会起作用。如果我突出显示远程桌面窗口,并按CTRL+ALT+DEL,它将解锁远程桌面会话
当我首先从Windows7机器远程到XP机器,然后从XP远程会话远程到另一个XP会话时,它甚至可以工作。我可以很好地解锁第二个XP会话
但是,当我从一台XP机器远程到另一台XP机器时,运行此脚本后,远程桌面会话将不会解锁。CTRL+ALT+DEL不起作用。我们必须进行硬重启才能重新进入机器,或者让其他人登录以启动锁定的会话
似乎每当您开始远程处理的本地计算机是XP时,它都不会解锁任何远程桌面会话。
有人知道解决这个问题的方法吗