ICivicAddressReport::GetCountryRegion 方法 (locationapi.h)

[Win32 位置 API 可用于“要求”部分中指定的操作系统。 它可能在后续版本中变更或不可用。 请改用 Windows.Devices.Geolocation API。 ]

检索两个字母的国家或地区代码。

语法

HRESULT GetCountryRegion(
  [out] BSTR *pbstrCountryRegion
);

参数

[out] pbstrCountryRegion

接收国家或地区代码的 BSTR 的地址。

返回值

如果该方法成功,则返回 S_OK。 否则,将返回 HRESULT 错误代码。

注解

双字母国家或地区代码采用 ISO 3166 格式。

示例

以下示例演示如何调用 GetCountryRegion

    hr = pCivicAddressReport->GetCountryRegion(&bstrCountryRegion);
    if (SUCCEEDED(hr)) 
    {
        // Country/Region is an ISO-3166-1 two-letter code.
       wprintf(L"\tCountry/Region:\t%s\n\n", bstrCountryRegion);    
    }       

要求

要求
最低受支持的客户端 Windows 7 [仅限桌面应用],Windows 7
最低受支持的服务器 无受支持的版本
目标平台 Windows
标头 locationapi.h
DLL LocationAPI.dll

另请参阅

ICivicAddressReport