| |
 |
SWAPI_CountryIDToContinentID
This function returns the continent ID corresponding to the given country ID.
Syntax
| Microsoft Visual C++ |
UCHAR __stdcall SWAPI_CountryIDToContinentID( WORD CountryID ); |
|
| Borland Delphi |
function SWAPI_CountryIDToContinentID( const CountryID: WORD ): Byte; stdcall; |
|
| Microsoft Visual Basic |
Declare Function SWAPI_CountryIDToContinentID Lib "swapimap.dll"( ByVal CountryID As Integer ) As Byte |
|
Parameters
| CountryID |
| [in] Country ID retrieved by using the functions for obtaining the country ID. |
Return Value
If the function succeeds, the return value is a non-zero continent ID, the value of which is within the boundaries returned by SWAPI_GetMinContinentID and SWAPI_GetMaxContinentID.
If the function fails, the return value is zero.
Sample Code
| Microsoft Visual C++ |
DWORD IPAddress; WORD CountryID; UCHAR ContinentID; CString ContinentName; LPSTR pStr;
IPAddress = 69956104; CountryID = SWAPI_IPAddressToCountryID(IPAddress, 0); if (CountryID == 0) { ContinentName = "Unknown"; } else { ContinentID = SWAPI_CountryIDToContinentID(CountryID); pStr = ContinentName.GetBuffer(13); pStr[SWAPI_ContinentIDToContinentName(ContinentID, pStr, 13)] = 0; ContinentName.ReleaseBuffer(); } AfxMessageBox(ContinentName); |
|
| Borland Delphi |
var IPAddress: DWORD; CountryID: WORD; ContinentID: Byte; ContinentName: string; begin IPAddress := 69956104; CountryID := SWAPI_IPAddressToCountryID(IPAddress, 0); if (CountryID = 0) then ContinentName := 'Unknown' else begin ContinentID := SWAPI_CountryIDToContinentID(CountryID); SetLength(ContinentName, 13); SetLength(ContinentName, SWAPI_ContinentIDToContinentName( ContinentID, Pointer(ContinentName), 13)); end; ShowMessage(ContinentName); end; |
|
| Microsoft Visual Basic |
Dim IPAddress As Long Dim CountryID As Integer Dim ContinentID As Byte Dim ContinentName As String Dim res As String * 64
IPAddress = 69956104 CountryID = SWAPI_IPAddressToCountryID(IPAddress, 0) If CountryID = 0 Then ContinentName = "Unknown" Else ContinentID = SWAPI_CountryIDToContinentID(CountryID) i = SWAPI_ContinentIDToContinentName(ContinentID, res, 64) ContinentName = Mid$(res, 1, i) End If MsgBox(ContinentName) |
|
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_GetMinContinentID SWAPI_GetMaxContinentID
Copyright © 2006-2008, TamoSoft
|