SetUserGeoName function

[Some information relates to pre-released product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.]

Sets the geographic location for the current user to the specified two-letter International Organization for Standardization (ISO) 3166-1 code or numeric United Nations (UN) Series M, Number 49 (M.49) code.

Syntax


BOOL WINAPI SetUserGeoName(
  _In_ PWSTR geoName
);

Parameters

geoName [in]

The two-letter ISO 3166-1 or numeric UN M.49 code for the geographic location to set for the current user. To get the codes that are available on the operating system, call EnumSystemGeoNames.

Return value

Returns TRUE if successful or FALSE otherwise.

If this function does not succeed, call GetLastError, which can return one of the following error codes:

Return codeDescription
ERROR_ACCESS_DISABLED_BY_POLICY

The group policy of the computer or the user has forbidden this operation.

ERROR_INTERNAL_ERROR

An unexpected error occurred in the function.

ERROR_INVALID_PARAMETER

A parameter value was invalid.

 

Remarks

This function writes to the registry the geographical location for a particular user instead of a particular application. This action affects the behavior of other applications that the user runs. As a rule, call this function only when the user has explicitly requested changes, but not for purely application-specific reasons.

For information about two-letter ISO 3166-1 codes, see Country Codes - ISO 3166. For information about numeric UN M.49 codes, see Standard country or area codes for statistical use (M49).

SetUserGeoName is intended for use by applications that are designed to change user settings, such as the Windows Settings app. Other applications should not call this function.

Requirements

Minimum supported client

Windows 10, version 1709 [desktop apps only]

Minimum supported server

Windows Server 2016 [desktop apps only]

Header

Winnls.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

National Language Support
National Language Support Functions
GetUserDefaultGeoName
EnumSystemGeoNames
SetUserGeoID

 

 

Show: