Send input on STA thread.

This commit is contained in:
Jared 2021-04-13 21:11:32 -07:00 committed by Jared Goodwin
parent 27c78038c5
commit c675e359fb

View File

@ -344,11 +344,13 @@ namespace Remotely.Desktop.Win.Services
{
if (!_inputBlocked)
{
if (!Win32Interop.SwitchToInputDesktop())
var inputThread = new Thread(() =>
{
Logger.Write("Desktop switch failed while sending input.");
}
inputAction();
Win32Interop.SwitchToInputDesktop();
inputAction();
});
inputThread.SetApartmentState(ApartmentState.STA);
inputThread.Start();
}
else
{