I'm trying to get the country code (example: "UK" or "SI" or "GER") via GetGeoInfo().
GEOID GetUserGeoID(GEOCLASS_NATION);
Currently getting the value 16 from the above function ^ but looking in the table there's no number 16.
https://msdn.microsoft.com/en-us/library/windows/desktop/dd374073(v=vs.85).aspx
I know it's only 3-4 lines of code but I can't seem to figure it out on my own. Any help would be appriciated.
EDIT:
GEOID myGEO = GetUserGeoID(GEOCLASS_NATION);
int sizeOfBuffer = GetGeoInfo(myGEO, GEO_ISO2, NULL, 0, 0);
WCHAR *buffer = new WCHAR[sizeOfBuffer];
int result = GetGeoInfo(myGEO, GEO_ISO2, buffer, sizeOfBuffer, 0);
Got it to display my country number but I don't know how I'd transform it into an ISO code.
To get the country ISO:
GEOID myGEO = GetUserGeoID(GEOCLASS_NATION);
int sizeOfBuffer = GetGeoInfo(myGEO, GEO_ISO2, NULL, 0, 0);
WCHAR *buffer = new WCHAR[sizeOfBuffer];
int result = GetGeoInfo(myGEO, GEO_ISO2, buffer, sizeOfBuffer, 0);
wcout<<buffer;
Thanks to @Christophe and @Thomas.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.