Skip to content

Latest commit

 

History

History
145 lines (117 loc) · 5.3 KB

nf-locationapi-idefaultlocation-setreport.md

File metadata and controls

145 lines (117 loc) · 5.3 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:locationapi.IDefaultLocation.SetReport
IDefaultLocation::SetReport (locationapi.h)
Sets the default location.
IDefaultLocation interface [WinLocation]
SetReport method
IDefaultLocation.SetReport
IDefaultLocation::SetReport
SetReport
SetReport method [WinLocation]
SetReport method [WinLocation]
IDefaultLocation interface
WinLocation_COM_Ref.idefaultlocation_setreport
locationapi/IDefaultLocation::SetReport
winlocation_com_ref\idefaultlocation_setreport.htm
winlocation
50355f93-e609-44d5-925a-2de7af1e0564
12/05/2018
IDefaultLocation interface [WinLocation],SetReport method, IDefaultLocation.SetReport, IDefaultLocation::SetReport, SetReport, SetReport method [WinLocation], SetReport method [WinLocation],IDefaultLocation interface, WinLocation_COM_Ref.idefaultlocation_setreport, locationapi/IDefaultLocation::SetReport
locationapi.h
Windows
Windows 7 [desktop apps only],Windows 7
None supported
LocationAPI.dll
Windows
19H1
IDefaultLocation::SetReport
locationapi/IDefaultLocation::SetReport
c++
APIRef
kbSyntax
COM
LocationAPI.dll
IDefaultLocation.SetReport

IDefaultLocation::SetReport

-description

[The Win32 Location API is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use the Windows.Devices.Geolocation API. ]

Sets the default location.

-parameters

-param reportType [in]

REFIID that represents the interface ID of the type of report that is passed using pLocationReport.

-param pLocationReport [in]

Pointer to the ILocationReport instance that contains the location report from the default location provider.

-returns

Possible values include, but are not limited to, those in the following table.

Return value Description
S_OK
The location report was successfully set.
E_INVALIDARG
The location report contains invalid data. This may occur when a civic address report does not contain a valid IS0 3166 two-letter country or region code, or when a latitude/longitude report does not contain a latitude between -90 and 90 or does not contain a longitude between -180 and 180.
E_ACCESSDENIED
The user does not have permission to set the default location.

-remarks

ILocationReport is the base interface of specific location report types. The actual interface you use for pLocationReport must match the type you specify through reportType.

Note that the type specified by reportType must be the IID of either ICivicAddressReport or ILatLongReport.

The latitude and longitude provided in a latitude/longitude report must correspond to a location on the globe. Otherwise this method returns an HRESULT error value.

Note  An application does not receive the expected location change event from OnLocationChanged if both of the following conditions are true. First, the application runs as a service, in the context of the LOCALSERVICE, SYSTEM, or NETWORKSERVICE user account. Second, the location change event results from changing the default location, either manually when the user selects Default Location in Control Panel, or programmatically when an application calls IDefaultLocation::SetReport.
 

Examples

The following example shows how to set the default location using a civic address report.

            // set the civic address fields of the Default Location
            hr = spDefaultLocation->SetReport(IID_ICivicAddressReport, spCivicAddressReport);
            if (E_INVALIDARG == hr)
            {
                wprintf(L"The civic address report has invalid data. ");
                wprintf(L"Country/region must be a valid ISO-3166 2-letter or 3-letter code.\n");
            }
            else if (E_ACCESSDENIED == hr)
            {
                wprintf(L"Administrator privilege required.\n");
            }

-see-also

IDefaultLocation