GetUserDefaultGeoName 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.]

Retrieves the two-letter International Organization for Standardization (ISO) 3166-1 code or numeric United Nations (UN) Series M, Number 49 (M.49) code for the default geographical location of the user.

Syntax


int WINAPI GetUserDefaultGeoName(
  _Out_ LPWSTR       geoName,
  _In_  geoNameCount int
);

Parameters

geoName [out]

Pointer to a buffer in which this function should write the null-terminated two-letter ISO 3166-1 or numeric UN M.49 code for the default geographic location of the user.

int [in]

The size of the buffer that the geoName parameter specifies. If this value is zero, the function only returns the number of characters that function would copy to the output buffer, but does not write the name of the default geographic location of the user to the buffer.

Return value

The number of characters the function would copy to the output buffer, if the value of the geoNameCount parameter is zero. Otherwise, the number of characters that the function copied to the buffer that the geoName parameter specifies.

Zero indicates that the function failed. To get extended error information, call GetLastError, which can return one of the following error codes:

Return codeDescription
ERROR_INVALID_PARAMETER

A parameter value was not valid.

ERROR_BADDB

The function could not read information from the registry.

ERROR_INSUFFICIENT_BUFFER

The buffer that the geoName parameter specifies is too small for the string.

 

Remarks

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

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
SetUserGeoName
GetUserGeoID

 

 

Show: