| |
 |
SWAPI_CountryCodeToCountryID
This function obtains the country ID by its ISO 3166-1 code.
Syntax
| Microsoft Visual C++ |
WORD __stdcall SWAPI_CountryCodeToCountryID ( PCHAR CountryCode ); |
|
| Borland Delphi |
function SWAPI_CountryCodeToCountryID( const CountryCode: PChar ): WORD; stdcall; |
|
| Microsoft Visual Basic |
Declare Function SWAPI_CountryCodeToCountryID Lib "swapimap.dll" ( ByVal CountryCode As String ) As Integer |
|
Parameters
| CountryCode |
| [in] Pointer to a null-terminated string that contains the country code. |
Return Value
If the function succeeds, the return value is a non-zero country ID.
If the function fails, the return value is zero.
Sample Code
| Microsoft Visual C++ |
WORD CountryID; CString CountryCode, CountryName; static CHAR result[65]; int i;
CountryCode = "US"; CountryID = SWAPI_CountryCodeToCountryID(PChar(CountryCode)); if (CountryID = 0) { CountryName = "Unknown"; } else { i = SWAPI_CountryIDToCountryName(CountryID, result, 64); result[i] = 0; CountryName = result; } AfxMessageBox(CountryName); |
|
| Borland Delphi |
var CountryID: WORD; CountryCode, CountryName: string; begin CountryCode := 'US'; CountryID := SWAPI_CountryCodeToCountryID(Pointer(CountryCode)); if (CountryID = 0) then CountryName := 'Unknown' else begin SetLength(CountryName, 64); SetLength(CountryName, SWAPI_CountryIDToCountryName(CountryID, Pointer(CountryName), 64)); end; ShowMessage(CountryName); end; |
|
| Microsoft Visual Basic |
Dim res As String * 64 CountryCode = "US" CountryID = SWAPI_CountryCodeToCountryID(CountryCode) if (CountryID = 0) then CountryName = "Unknown" else i = SWAPI_CountryIDToCountryName(CountryID, res, 64) CountryName = Mid$(res, 1, i) End if MsgBox(CountryName) |
|
Defined In
| Microsoft Visual C++ |
| SWAPIMap.h, SWAPIMap.cpp |
|
| Borland Delphi |
| SWAPIMap.pas |
|
| Microsoft Visual Basic |
| SWAPIMap.bas |
|
See Also
SWAPI_CountryIDToCountryCode ISO 3166-1 Decoding Table
Copyright © 2006-2008, TamoSoft
|