babalae/better-genshin-impact · error · InvalidOperationException
无法将键盘焦点切换到桌面分身。
Error message
无法将键盘焦点切换到桌面分身。
What it means
Error "无法将键盘焦点切换到桌面分身。" thrown in babalae/better-genshin-impact.
Source
Thrown at BetterGenshinImpact/View/Controls/ChildSession/RdpActiveXHost.cs:295
_eventSink = null;
}
finally
{
base.DetachSink();
}
}
private void SendShortcut(KeyStroke[] strokes, string displayName)
{
if (ConnectedState != 1)
{
throw new InvalidOperationException(
$"桌面分身尚未完全连接,无法发送 {displayName}。");
}
if (!ChildSessionNativeMethods.TryFocusRdpInputWindow(Handle))
{
throw new InvalidOperationException("无法将键盘焦点切换到桌面分身。");
}
RunComStep($"向 Child Session 发送 {displayName}", () => SendKeyStrokes(strokes));
}
private void SendKeyStrokes(KeyStroke[] strokes)
{
var keyUpStates = new short[strokes.Length];
var keyData = new int[strokes.Length];
for (var index = 0; index < strokes.Length; index++)
{
var stroke = strokes[index];
keyUpStates[index] = stroke.IsKeyUp ? VariantTrue : VariantFalse;
keyData[index] = CreateRdpScanCode(stroke.Key);
}
var nonScriptableClient = (IMsRdpClientNonScriptable)GetRequiredOcx();View on GitHub (pinned to a7cb36712d)
Solutions
- 先点击桌面分身窗口使其获得焦点
- 确认桌面分身连接正常且未被最小化
- 重试或将焦点切换回主窗口后再次尝试
Example fix
确保桌面分身窗口可见且未被最小化,点击其窗口后再试;关闭可能抢焦点的覆盖层应用。
When it happens
Trigger: 已连接状态下调用 TryFocusRdpInputWindow 把键盘焦点切到 RDP 输入窗口失败时抛出。
Common situations: 桌面分身窗口被最小化/遮挡或焦点被系统其它窗口抢占,原生焦点切换失败。
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/fb0d8e220b187c21.
Report an issue: GitHub.