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_GetCountryFlagsImageList

This function creates an image list that contains the flags of all countries that are included in the officially assigned 3166-1 code list. This function returns a handle to the created image list.

Syntax

Microsoft Visual C++
HIMAGELIST __stdcall SWAPI_GetCountryFlagsImageList();
Borland Delphi
function SWAPI_GetCountryFlagsImageList: HIMAGELIST; stdcall;
Microsoft Visual Basic
Declare Function SWAPI_GetCountryFlagsImageList Lib "swapires.dll" () As Long

Parameters

This function has no parameters.

Return Value

If the function succeeds, the return value is the handle to the created (or existing, see remarks) image list.

If the function fails, the return value is NULL.

Remarks

This function uses the ImageList_Create function with the ILC_COLORDDB and ILC_MASK flags as the flags parameter. To create an image list with different parameters, use the SWAPI_GetCountryFlagsImageListEx function.

You don't have to destroy the created images list, as it will be automatically destroyed on program exit. If you still need to destroy it for whatever reason (e.g. for freeing system resources or recreating it with different parameters using the SWAPI_GetCountryFlagsImageListEx function), you must use SWAPI_DestroyCountryFlagsImageList; don't use ImageList_Destroy.

All subsequent calls to this function (before you call SWAPI_DestroyCountryFlagsImageList) will return a handle to the previously created image list.

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

SWAPI_GetCountryFlagsImageListEx
SWAPI_DestroyCountryFlagsImageList


Copyright © 2006-2008, TamoSoft