| |
 |
SWAPI_CountryIDToContinentName
This function retrieves the continent name by the country ID.
Syntax
| Microsoft Visual C++ |
DWORD __stdcall SWAPI_CountryIDToContinentName( WORD CountryID, PVOID DstBuff, DWORD DstSize ); |
|
| Borland Delphi |
function SWAPI_CountryIDToContinentName( const CountryID: WORD; const DstBuff: Pointer; const DstSize: DWORD ): DWORD; stdcall; |
|
| Microsoft Visual Basic |
Declare Function SWAPI_CountryIDToContinentName Lib "swapimap.dll" ( ByVal CountryID As Integer, ByVal DstBuff As String, ByVal DstSize As Long ) As Long |
|
Parameters
| CountryID |
[in] Country ID retrieved by using the functions for obtaining the country ID.
|
| DstBuff |
[out] Pointer to the buffer to receive the string containing the continent name.
|
| DstSize |
| [in] Size of the buffer specified by the DstBuff parameter in bytes. This value should be set to 13 or greater. |
Return Value
If the function succeeds, the return value is non-zero. If the return value is greater than DstSize, the value returned is the size of DstBuff required to hold the name. Otherwise, the value returned is the length of the string copied to DstBuff.
If the function fails, the return value is zero.
Remarks
The terminating null character is not copied to the buffer specified by DstBuff. Use the function return value to determine the length of the string copied to DstBuff.
Sample Code
| Microsoft Visual C++ |
DWORD IPAddress; WORD CountryID; static CHAR result[14]; CString ContinentName; int i;
IPAddress = 69956104; CountryID = SWAPI_IPAddressToCountryID(IPAddress, 0); if (CountryID == 0) { ContinentName = "Unknown"; } else { i = SWAPI_CountryIDToContinentName(CountryID, result, 13); result[i] = 0; ContinentName = result; } AfxMessageBox(ContinentName); |
|
| Borland Delphi |
var IPAddress: DWORD; CountryID: WORD; ContinentName: string; begin IPAddress := 69956104; CountryID := SWAPI_IPAddressToCountryID(IPAddress, 0); if (CountryID = 0) then ContinentName := 'Unknown' else begin SetLength(ContinentName, 13); SetLength(ContinentName, SWAPI_CountryIDToContinentName(CountryID, Pointer(ContinentName), 13)); end; ShowMessage(ContinentName); end; |
|
| Microsoft Visual Basic |
Dim res As String * 13 IPAddress = 69956104 CountryID = SWAPI_IPAddressToCountryID(IPAddress, 0) if (CountryID = 0) then ContinentName = "Unknown" else i = SWAPI_CountryIDToContinentName(CountryID, res, 13) 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_ContinentIDToContinentName
Copyright © 2006-2008, TamoSoft
|