TF_CreateDisplayAttributeMgr function

The TF_CreateDisplayAttributeMgr function is used to create a display attribute 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 display attribute manager objects be created using CoCreateInstance , as demonstrated in ITfDisplayAttributeMgr.

Syntax


HRESULT TF_CreateDisplayAttributeMgr(
  _Out_ ITfDisplayAttributeMgr **ppdam
);

Parameters

ppdam [out]

Pointer to an ITfDisplayAttributeMgr interface pointer that receives the display attribute manager object.

Return value

ValueMeaning
S_OKThe function was successful.
E_FAILAn unspecified error occurred.
E_INVALIDARGppdam 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_CREATEDISPLAYATTRIBUTEMGR)(ITfDisplayAttributeMgr**);

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

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

else
{
    PTF_CREATEDISPLAYATTRIBUTEMGR pfnCreateDispAttrMgr;
    
    pfnCreateDispAttrMgr = (PTF_CREATEDISPLAYATTRIBUTEMGR)GetProcAddress(hMSCTF, "TF_CreateDisplayAttributeMgr");

    if(pfnCreateDispAttrMgr)
    {
        HRESULT hr;
        ITfDisplayAttributeMgr *pDispAttrMgr;

        hr = (*pfnCreateDispAttrMgr)(&pDispAttrMgr);
        if(SUCCEEDED(hr))
        {
            pDispAttrMgr->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
ITfDisplayAttributeMgr
GetProcAddress
LoadLibrary

 

 

Show: