Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Associates the focus for a window with a document manager object.
HRESULT AssociateFocus(
[in] HWND hwnd,
[in] ITfDocumentMgr *pdimNew,
[out] ITfDocumentMgr **ppdimPrev
);
[in] hwnd
Handle of the window to associate the focus with.
[in] pdimNew
Pointer to the document manager to associate the focus with. The TSF manager does not increment the object reference count. This value can be NULL.
[out] ppdimPrev
Receives the document manager previously associated with the window. Receives NULL if there is no previous association. This parameter cannot be NULL.
This method can return one of these values.
Value | Description |
---|---|
|
The method was successful. |
|
One or more parameters are invalid. |
This method is provided as a convenience to the application developer. Associating the focus for a window with a document manager causes the TSF manager to automatically call ITfThreadMgr::SetFocus with the associated document manager when the associated window receives the focus.
This method can only associate a single window with a single document manager. If the implementation associates multiple document managers with a single window, or the opposite, the implementation must call ITfThreadMgr::SetFocus to set the focus to the proper document manager.
To restore the previous focus association, call this method with the same window handle and the value returned in the original call ppdimPrev for pdimNew. The following is an example.
//associate the focus for m_hwnd with m_pDocMgr
pThreadMgr->AssociateFocus(m_hwnd, m_pDocMgr, &m_pPrevDocMgr);
//Restore the original focus association.
ITfDocumentMgr *pTempDocMgr = NULL;
pThreadMgr->AssociateFocus(m_hwnd, m_pPrevDocMgr, &pTempDocMgr);
if(pTempDocMgr)
{
pTempDocMgr->Release();
}
if(m_pPrevDocMgr)
{
m_pPrevDocMgr->Release();
}
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | msctf.h |
DLL | Msctf.dll |
Redistributable | TSF 1.0 on Windows 2000 Professional |
Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register today