ELS 애플리케이션은 MappingGetServices 함수를 호출하여 운영 체제에서 사용할 수 있는 서비스를 결정합니다. 이 함수는 사용 가능한 모든 ELS 서비스를 열거하거나 애플리케이션에서 제공하는 검색 조건에 따라 서비스를 필터링하는 데 사용할 수 있습니다. 서비스가 더 이상 필요하지 않은 경우 애플리케이션은 MappingFreeServices호출합니다.
지원되는 모든 서비스 가져오기
이 코드 예제에서는 MappingGetServices 및 MappingFreeServices 사용하여 운영 체제에서 사용 가능한 모든 서비스를 열거한 다음 해제하는 방법을 보여 줍니다. 이를 위해 애플리케이션은 MappingGetServicespOptions 매개 변수에 NULL 전달합니다.
#include <windows.h>
#include <stdio.h>
#include <elscore.h>
int __cdecl main()
{
PMAPPING_SERVICE_INFO prgServices = NULL;
DWORD dwServicesCount = 0;
HRESULT Result;
DWORD i;
// Get all installed ELS services.
Result = MappingGetServices(NULL, &prgServices, &dwServicesCount);
if (SUCCEEDED(Result))
{
for (i = 0; i < dwServicesCount; ++i)
{
// Do something with each service.
// ... prgServices[i] ...
printf_s("Service: %ws, category: %ws\n",
prgServices[i].pszDescription, prgServices[i].pszCategory);
}
MappingFreeServices(prgServices);
}
return 0;
}
특정 서비스 가져오기
다음 예제에서는 MappingGetServices 및 MappingFreeServices 사용하여 "언어 검색" 범주의 모든 서비스를 열거한 다음 해제하는 방법을 보여 줍니다. 이 서비스 범주에 대한 자세한 내용은 Microsoft 언어 감지참조하세요.
#include <windows.h>
#include <stdio.h>
#include <elscore.h>
int __cdecl main()
{
MAPPING_ENUM_OPTIONS EnumOptions;
PMAPPING_SERVICE_INFO prgServices = NULL;
DWORD dwServicesCount = 0;
HRESULT Result;
DWORD i;
ZeroMemory(&EnumOptions, sizeof (MAPPING_ENUM_OPTIONS));
EnumOptions.Size = sizeof (MAPPING_ENUM_OPTIONS);
// Use the Language Auto-Detection category to enumerate
// all language detection services.
EnumOptions.pszCategory = L"Language Detection";
// Execute the enumeration:
Result = MappingGetServices(&EnumOptions, &prgServices, &dwServicesCount);
if (SUCCEEDED(Result))
{
for (i = 0; i < dwServicesCount; ++i)
{
// Do something with each service.
// ... prgServices[i] ...
printf_s("Service: %ws, category: %ws\n",
prgServices[i].pszDescription, prgServices[i].pszCategory);
}
MappingFreeServices(prgServices);
}
return 0;
}
관련 항목
-
확장 언어 서비스 사용하는