Windows-classic-samples/Samples/IME/cpp/SampleIME/TfInputProcessorProfile.cpp
2025-11-28 00:35:46 +09:00

55 lines
1.4 KiB
C++

// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved
#include "Private.h"
#include "TfInputProcessorProfile.h"
CTfInputProcessorProfile::CTfInputProcessorProfile()
{
_pInputProcessorProfile = nullptr;
}
CTfInputProcessorProfile::~CTfInputProcessorProfile()
{
if (_pInputProcessorProfile) {
_pInputProcessorProfile->Release();
_pInputProcessorProfile = nullptr;
}
}
HRESULT CTfInputProcessorProfile::CreateInstance()
{
HRESULT hr = CoCreateInstance(CLSID_TF_InputProcessorProfiles, nullptr, CLSCTX_INPROC_SERVER,
IID_ITfInputProcessorProfiles, (void**)&_pInputProcessorProfile);
return hr;
}
HRESULT CTfInputProcessorProfile::GetCurrentLanguage(_Out_ LANGID *plangid)
{
if (_pInputProcessorProfile)
{
return _pInputProcessorProfile->GetCurrentLanguage(plangid);
}
else
{
return E_FAIL;
}
}
HRESULT CTfInputProcessorProfile::GetDefaultLanguageProfile(LANGID langid, REFGUID catid, _Out_ CLSID *pclsid, _Out_ GUID *pguidProfile)
{
if (_pInputProcessorProfile)
{
return _pInputProcessorProfile->GetDefaultLanguageProfile(langid, catid, pclsid, pguidProfile);
}
else
{
return E_FAIL;
}
}