ITfFnReconversion::QueryRange outputs NULL with "Microsoft IME(Japanese)"

210 Views Asked by At

Referencing the article of Get the candicate list by TSF(sorry, it's written by Japanese), I have developed a C++ Component of Windows Store App.
But when I test the Component, there is a curious phenomenon: If I turn the Input Method into "Microsoft IME", the code

hr = m_reconversion_cp->QueryRange(selections[0].range, &range_cp, &is_converted);  

always returns NULL in the output param "range_cp", but if I turn the Input Method into "Google 日本語入力" the "range_cp" will return right result and I can get the candidate List by ITfFnReconversion::GetReconversion.
Has someone encountered the same issue? Or I missed some settings of the Microsoft IME?

There is the part of code of this issue:

ReconvTextStore m_text_store_cp;
ITfContext m_context_cp;
ITfFnReconversion m_reconversion_cp

if (m_text_store_cp->LockDocument(TS_LF_READ))
{
    hr = m_context_cp->GetSelection(
        m_edit_cookie,
        TF_DEFAULT_SELECTION,
        numberof(selections),
        selections,
        &fetched_count
        );

    m_text_store_cp->UnlockDocument();

    if (FAILED(hr))
    {
        break;
    }
}

// ↓↓↓ When the Microsoft IME, range_cp returns NULL ↓↓↓
hr = m_reconversion_cp->QueryRange(selections[0].range, &range_cp, &is_converted);
if (FAILED(hr) || range_cp == NULL)
{
    break;
}

hr = m_reconversion_cp->GetReconversion(selections[0].range, &cand_list_cp);
if (FAILED(hr) || cand_list_cp == NULL)
{
    break;
}

I really appreciate any help you can provide.

0

There are 0 best solutions below