ICON: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
No edit summary |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 22: | Line 22: | ||
=== Errors === | === Errors === | ||
* Images used can be smaller or larger than 32 X 32 pixels, but image resolution may be affected. | * 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 | * It is important to free unused or unneeded 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.''' | *In '''SCREEN 0''' (default text mode) you need to specify 32-bit mode in [[_LOADIMAGE]] to load images.''' | ||
{{PageAvailability}} | |||
<!-- QB64 = a version or none, QBPE = a version or all, Platforms = yes or no --> | |||
<gallery widths="48px" heights="48px" mode="nolines"> | |||
File:Qb64.png|'''v0.840''' | |||
File:Qbpe.png|'''all''' | |||
File:Apix.png | |||
File:Win.png|'''yes''' | |||
File:Lnx.png|'''yes''' | |||
File:Osx.png|'''yes''' | |||
</gallery> | |||
<!-- Additional availability notes go below the gallery, e.g. --> | |||
{{PageExamples}} | {{PageExamples}} | ||
''Example 1:'' | ''Example 1:'' Setting the program icon using a 32-bit image in SCREEN 0 (the default screen mode). | ||
{{CodeStart}} | {{CodeStart}} | ||
i& ={{Cl|_LOADIMAGE}}("RDSWU16.BMP", 32) '<<<<<<< use your image file name here | i& ={{Cl|_LOADIMAGE}}("RDSWU16.BMP", 32) '<<<<<<< use your image file name here | ||
Line 39: | Line 51: | ||
{{CodeEnd}} | {{CodeEnd}} | ||
:''Note:'' _ICON images can be freed if the [[SCREEN]] mode stays the same. Freed image handles can on longer be referenced. | :''Note:'' _ICON images can be freed if the [[SCREEN]] mode stays the same. Freed image handles can on longer be referenced. | ||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [[_TITLE]] | * [[_TITLE]] | ||
* [[_LOADIMAGE]] | * [[_LOADIMAGE]], [[_SAVEIMAGE]] | ||
* [[$EXEICON]] | * [[$EXEICON]] | ||
* [[Creating Icon Bitmaps]] | * [[Creating Icon Bitmaps]] | ||
* [[Bitmaps]], [[Icons and Cursors]] | * [[Bitmaps]], [[Icons and Cursors]] | ||
* [[Resource Table extraction#Extract_Icon|Icon Extraction]] | * [[Resource Table extraction#Extract_Icon|Icon Extraction]] |
Latest revision as of 17:57, 21 July 2024
The _ICON statement uses an image handle from _LOADIMAGE for the program header and icon image in the OS.
Syntax
- _ICON [mainImageHandle&[, smallImageHandle&]]
Parameters
- mainImageHandle& is the LONG handle value of the OS icon and title bar image pre-loaded with _LOADIMAGE when used alone.
- 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.
Description
- 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:
- mainImageHandle& creates the image as the icon in the OS and the image in the program header (title bar).
- 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.
Errors
- 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 unneeded 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.
Availability
Examples
Example 1: Setting the program icon using a 32-bit image in SCREEN 0 (the default screen mode).
i& =_LOADIMAGE("RDSWU16.BMP", 32) '<<<<<<< use your image file name here IF i& < -1 THEN _ICON i& _FREEIMAGE i& ' release image handle after setting icon END IF |
- Note: _ICON images can be freed if the SCREEN mode stays the same. Freed image handles can on longer be referenced.
See also
- _TITLE
- _LOADIMAGE, _SAVEIMAGE
- $EXEICON
- Creating Icon Bitmaps
- Bitmaps, Icons and Cursors
- Icon Extraction