TF_CreateThreadMgr function

The TF_CreateThreadMgr function creates a thread manager object without having to initialize COM. Usage of this method is not recommended, because the calling process must maintain a proper reference count on an object that is owned by Msctf.dll.

It is instead recommended that thread manager objects be created using CoCreateInstance , as demonstrated in ITfThreadMgr.

Syntax


HRESULT TF_CreateThreadMgr(
  _Out_  ITfThreadMgr **pptim
);

Parameters

pptim [out]

Pointer to an ITfThreadMgr interface pointer that receives the thread manager object.

Return value

ValueMeaning
S_OKThe function was successful.
E_FAILAn unspecified error occurred.
E_INVALIDARGpptim is invalid.

 

Examples

There is no import library available that defines this function, so it is necessary to manually obtain a pointer to this function using LoadLibrary and GetProcAddress. The following code example demonstrates how to accomplish this.

Note  

Using LoadLibrary incorrectly can compromise the security of your application by loading the wrong DLL. Refer to the LoadLibrary documentation for information on how to correctly load DLLs with different versions of Windows.



typedef HRESULT (WINAPI *PTF_CREATETHREADMGR)(ITfThreadMgr**);

HMODULE hMSCTF = LoadLibrary(TEXT("msctf.dll"));

if(hMSCTF == NULL)
{
    //Error loading module -- fail as securely as possible 
}

else
{
    PTF_CREATETHREADMGR pfnCreateThreadMgr;
    
    pfnCreateThreadMgr = (PTF_CREATETHREADMGR)GetProcAddress(hMSCTF, "TF_CreateThreadMgr");

    if(pfnCreateThreadMgr)
    {
        HRESULT hr;
        ITfThreadMgr *pThreadMgr;

        hr = (*pfnCreateThreadMgr)(&pThreadMgr);
        if(SUCCEEDED(hr))
        {
            pThreadMgr->Release();
        }
    }

    FreeLibrary(hMSCTF);
}


Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Redistributable

TSF 1.0 on Windows 2000 Professional

Header

Msctf.h

DLL

Msctf.dll

See also

CoCreateInstance
GetProcAddress
ITfThreadMgr
LoadLibrary

 

 

Community Additions

ADD
Show:
© 2014 Microsoft