| |
 |
SWAPI_GetCountryCodeStatus
Use this function to obtain the current ISO 3166-1 country code status for the given country ID.
Syntax
| Microsoft Visual C++ |
WORD __stdcall SWAPI_GetCountryCodeStatus( WORD CountryID ); |
|
| Borland Delphi |
function SWAPI_GetCountryCodeStatus( const CountryID: WORD ): WORD; stdcall; |
|
| Microsoft Visual Basic |
Declare Function SWAPI_GetCountryCodeStatus Lib "swapimap.dll" ( ByVal CountryID As Integer ) As Integer |
|
Parameters
| CountryID |
| [in] Country ID retrieved by using the functions for obtaining the country ID. |
Return Value
If the function succeeds, the return value contains the current ISO 3166-1 country code status for the given country ID. This status can be one or more of the following values:
| Status |
Value |
Meaning |
| CODE_STATUS_ISO_PRIVATELY_USED |
0x0001 |
Unassigned ISO 3166-1 code element privately used in this SDK. E.g. "AP" is not an officially assigned code, but it is used in this SDK to define "Asia Pacific Region". |
| CODE_STATUS_ISO_OFFICIALLY_ASSIGNED |
0x0002 |
Officially assigned ISO 3166-1 code element (may be used without restriction). |
| CODE_STATUS_ISO_USER_ASSIGNED |
0x0004 |
User-assigned ISO 3166-1 code element (may be used without restriction). |
| CODE_STATUS_ISO_EXCEPTIONALLY_RESERVED |
0x0008 |
Exceptionally reserved ISO 3166-1 code element (may be used but restrictions may apply). |
| CODE_STATUS_ISO_TRANSITIONALLY_RESERVED |
0x0010 |
Transitionally reserved ISO 3166-1 code element (deleted from ISO 3166-1, stop using ASAP). |
| CODE_STATUS_ISO_INDETERMINATELY_RESERVED |
0x0020 |
Indeterminately reserved ISO 3166-1 code element (must not be used in ISO 3166-1). |
| CODE_STATUS_ISO_NOT_USED |
0x0040 |
ISO 3166-1 code element not used at present stage (must not be used in ISO 3166-1). |
| CODE_STATUS_ISO_UNASSIGNED |
0x0080 |
Unassigned ISO 3166-1 code element (free for assignment by ISO 3166/MA only). |
| CODE_STATUS_SWAPI_USED |
0x0003 |
CODE_STATUS_ISO_OFFICIALLY_ASSIGNED and CODE_STATUS_ISO_PRIVATELY_USED bitmask. |
If the function fails, the return value is zero.
Sample Code
| Microsoft Visual C++ |
int i, minCC, maxCC; WORD Status, Filter; static CHAR result[3]; CString CountryCode;
Filter = CODE_STATUS_ISO_OFFICIALLY_ASSIGNED | CODE_STATUS_ISO_PRIVATELY_USED; minCC = GetMinCountryID(); maxCC = GetMaxCountryID(); for (i = minCC; i < maxCC; i++ ) { Status = SWAPI_GetCountryCodeStatus(i); if (Status & Filter) { i = SWAPI_CountryIDToCountryName(CountryID, result, 2); result[i] = 0; CountryCode = result; lstCodes.InsertItem(i, CountryCode); } } |
|
| Borland Delphi |
var CountryID : WORD; CountryCode: string; const Filter = CODE_STATUS_ISO_OFFICIALLY_ASSIGNED or CODE_STATUS_ISO_PRIVATELY_USED; begin SetLength(CountryCode, 2); for CountryID := SWAPI_GetMinCountryID to SWAPI_GetMaxCountryID do if ((SWAPI_GetCountryCodeStatus(CountryID) and Filter) <> 0) then begin SWAPI_CountryIDToCountryCode(CountryID, Pointer(CountryCode), 2); Memo1.Lines.Add(CountryCode); end; end; |
|
| Microsoft Visual Basic |
Filter = CODE_STATUS_ISO_OFFICIALLY_ASSIGNED Or CODE_STATUS_ISO_PRIVATELY_USED Dim res As String * 2 For CountryID = SWAPI_GetMinCountryID() to SWAPI_GetMaxCountryID() If (SWAPI_GetCountryCodeStatus(CountryID) And Filter) <> 0 Then i = SWAPI_CountryIDToCountryCode(CountryID, res, 2) CountryCode = Mid$(res, 1, i) Memo1.Lines.Add(CountryCode) End If Next |
|
Defined In
| Microsoft Visual C++ |
| SWAPIMap.h, SWAPIMap.cpp |
|
| Borland Delphi |
| SWAPIMap.pas |
|
| Microsoft Visual Basic |
| SWAPIMap.bas |
|
See Also
Functions for Obtaining the Country ID SWAPI_GetCountryCodeIndex ISO 3166-1 Decoding Table
Copyright © 2006-2008, TamoSoft
|