Home
Contents

CountryWhois SDK

 
CountryWhois SDK
About CountryWhois SDK
Using CountryWhois SDK
Functions for Obtaining the Country ID
SWAPI_IPAddressToCountryID
SWAPI_IPStringToCountryID
SWAPI_CountryCodeToCountryID
SWAPI_GetMinCountryID
SWAPI_GetMaxCountryID
Functions for Obtaining Information About a Country
SWAPI_CountryIDToCountryCode
SWAPI_CountryIDToCountryName
SWAPI_CountryIDToContinentCode
SWAPI_CountryIDToContinentName
SWAPI_GetCountryCodeStatus
SWAPI_GetCountryCodeIndex
SWAPI_EnumCountryIPRanges
EnumIPRangesProc
Functions for Obtaining the Continent ID
SWAPI_CountryIDToContinentID
SWAPI_ContinentCodeToContinentID
SWAPI_GetMinContinentID
SWAPI_GetMaxContinentID
Functions for Obtaining Information About a Continent
SWAPI_ContinentIDToContinentCode
SWAPI_ContinentIDToContinentName
SWAPI_EnumContinentIPRanges
SWAPI_EnumContinentCountries
EnumCountriesProc
Country Flags
SWAPI_GetCountryFlagBitmap
SWAPI_GetCountryFlagsImageList
SWAPI_GetCountryFlagsImageListEx
SWAPI_GetCountryFlagsImageListIndex
SWAPI_DestroyCountryFlagsImageList

SWAPI_GetCountryFlagsImageListIndex

This function returns the country flag image index in the image list that was created using the SWAPI_GetCountryFlagsImageList or SWAPI_GetCountryFlagsImageListEx functions.

Syntax

Microsoft Visual C++
long __stdcall SWAPI_GetCountryFlagsImageListIndex(
  WORD CountryID
);
Borland Delphi
function SWAPI_GetCountryFlagsImageListIndex(
  const CountryID: WORD
): Longint; stdcall;
Microsoft Visual Basic
Declare Function SWAPI_GetCountryFlagsImageListIndex Lib "swapires.dll" (
  ByVal CountryID As Integer
) As Long

Parameters

CountryID
[in] Country ID retrieved by using the functions for obtaining the country ID.

Return Value

If the country code corresponding to the given country ID is on the officially assigned ISO 3166-1 list, then the return value is a zero-based ordinal image number that contains the country flag in the image list (in this case the return values correspond to the values returned by SWAPI_GetCountryCodeIndex). Otherwise, the return value is the image index of the bitmap that depicts a white flag with a question sign in the center (SWAPI_GetCountryCodeIndex returns -1 in such cases).

If the function fails, the return value is -1.

Sample Code

Microsoft Visual C++
void DrawFlag(WORD CountryID, HDC DC, int X, int Y)
{
  HIMAGELIST hFlags = SWAPI_GetCountryFlagsImageList();
  ImageList_DrawEx(hFlags, SWAPI_GetCountryFlagsImageListIndex(CountryID),
    DC, X, Y, 0, 0, CLR_NONE, CLR_NONE, ILD_TRANSPARENT);
}
Borland Delphi
procedure DrawFlag(const CountryID: WORD; const DC: HDC;
  const X, Y: Integer);
begin
  ImageList_DrawEx(SWAPI_GetCountryFlagsImageList,
    SWAPI_GetCountryFlagsImageListIndex(CountryID), DC, X, Y,
    0, 0, CLR_NONE, CLR_NONE, ILD_TRANSPARENT);
end;
Microsoft Visual Basic
Sub DrawFlag(ByVal CountryID As Integer, ByVal DC As Long,
  ByVal x As Integer, ByVal y As Integer)
  ImageList_DrawEx SWAPI_GetCountryFlagsImageList(),
    SWAPI_GetCountryFlagsImageListIndex(CountryID), DC, x, y,
    0, 0, CLR_NONE, CLR_NONE, ILD_TRANSPARENT
End Sub

Defined In

Microsoft Visual C++
SWAPIRes.h, SWAPIRes.cpp
Borland Delphi
SWAPIRes.pas
Microsoft Visual Basic
SWAPIRes.bas

See Also

Functions for Obtaining the Country ID
SWAPI_GetCountryFlagsImageList
SWAPI_GetCountryFlagsImageListEx
SWAPI_GetCountryCodeIndex
ISO 3166-1 Decoding Table


Copyright © 2006-2008, TamoSoft