Skip to content

Windows环境下同个electron应用中划词时,SendCopyKey()延迟生效导致划词总是失败 #11

@Mn4CaO5

Description

@Mn4CaO5

在同个electron应用界面上划词时,如果回退"剪贴板"方式,模拟的"Ctrl+Insert/Ctrl+C"会在等待剪贴板变化结束后才生效(spy++观察)。

bool SelectionHook::GetSelectedText(HWND hwnd, TextSelectionInfo &selectionInfo)
{
    ...

    // First try UI Automation (supported by modern applications)
    if (false && pUIAutomation && GetTextViaUIAutomation(hwnd, selectionInfo))
    {
        selectionInfo.method = SelectionMethod::UIA;
        is_processing.store(false);
        return true;
    }

    // Fall back to IAccessible interface (supported by older applications)
    if (false && GetTextViaAccessible(hwnd, selectionInfo))
    {
        selectionInfo.method = SelectionMethod::Accessible;
        is_processing.store(false);
        return true;
    }

    ...
}

重新编译selection-hook后,替换到Cherry Studio中验证复现。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions