* {{Parameter|mainImageHandle&}} is the [[LONG]] handle value of the OS icon and title bar image pre-loaded with [[_LOADIMAGE]] when used alone.
* {{Parameter|smallImageHandle&}} is the [[LONG]] handle value of a different title bar image pre-loaded with [[_LOADIMAGE]] when used.
* No image handle designates use of the default QB64 icon or the embedded icon set by [[$EXEICON]].
{{PageDescription}}
* If no image handle is passed, the default QB64 icon will be used (all versions). If the [[$EXEICON]] metacommand is used, [[_ICON]] without an image handle uses the embedded icon from the binary (Windows only).
* Beginning with '''version 1.000''', the following is considered:
:::{{Parameter|mainImageHandle&}} creates the image as the icon in the OS and the image in the program header (title bar).
:::{{Parameter|smallImageHandle&}} can be used for a different image in the program header bar.
*The header image will automatically be resized to fit the icon size of 16 X 16 if smaller or larger.
*Once the program's icon is set, the image handle can be discarded with [[_FREEIMAGE]].
{{PageErrors}}
* '''NOTE: Icon files are not supported with [[_LOADIMAGE]] and an error will occur. See Example 2.'''
* Images used can be smaller or larger than 32 X 32 pixels, but image resolution may be affected.
* It is important to free unused or uneeded images with [[_FREEIMAGE]] to prevent memory overflow errors.
*In '''SCREEN 0''' (default text mode) you need to specify 32-bit mode in [[_LOADIMAGE]] to load images.'''
{{PageExamples}}
''Example 1:'' Loading an image to a 32 bit palette in SCREEN 0 (the default screen mode).
{{CodeStart}}
i& ={{Cl|_LOADIMAGE}}("RDSWU16.BMP", 32) '<<<<<<< use your image file name here
{{Cl|IF}} i& < -1 THEN
{{Cl|_ICON}} i&
{{Cl|_FREEIMAGE}} i& ' release image handle after setting icon
{{Cl|END IF}}
{{CodeEnd}}
:''Note:'' _ICON images can be freed if the [[SCREEN]] mode stays the same. Freed image handles can on longer be referenced.
''Example 2:'' Function that converts an icon into a temporary bitmap for use in QB64. Function returns the available image count.
{{CodeStart}}
{{Cl|SCREEN}} {{Cl|_NEWIMAGE}}(640, 480, 256)
{{Cl|_TITLE}} "Icon Converter"
icon$ = "daphne.ico" '<<<<<<<<< change icon file name
bitmap$ = "tempfile.bmp"
indx% = 6 '1 minimum <<<<<<< higher values than count get highest entry image in icon file