SetUserGeoID function (winnls.h)

[SetUserGeoID is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use SetUserGeoName.


Sets the geographical location identifier for the user. This identifier should have one of the values described in Table of Geographical Locations.


BOOL SetUserGeoID(
  [in] GEOID GeoId


[in] GeoId

Identifier for the geographical location of the user.

Return value

Returns TRUE if successful or FALSE otherwise.

Windows XP, Windows Server 2003: This function does not supply extended error information. Thus it is not appropriate for an application to call GetLastError after this function. If the application does call GetLastError, it can return a value set by some previously called function.

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

  • 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. Any of the parameter values was invalid.


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 run by the user. As a rule, the application should call this function only when the user has explicitly requested changes, but not for purely application-specific reasons.

SetUserGeoID 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.


Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winnls.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also


National Language Support

National Language Support Functions


Table of Geographical Locations