Using the handle of a resource

ClearWin+ controls that take the name of a bitmap, icon, or cursor resource, can be given a string consisting of a decimal integer enclosed in curly brackets (with no embedded spaces), for example {21542}. The number should be the decimal value of a Windows handle to an object of the appropriate type. If the handle is invalid the results will be unpredictable.

For example:

CHARACTER*32 icon(32),handle
icon(1)=...
...
icon(32)=...
WRITE(handle,'(i10.10)') make_icon@(icon)
i=winio@('%ic[{'//handle//'}]')

For %bm (Bitmap), %ic (Icon), %mi (Minimised Icon), %cu (Cursor), and %dc (Default Cursor) it is easier to use a grave accent, supplying the handle as an integer argument. However, the above technique is useful for other format codes (e.g. %bi (Button Icon), %ti (Taskbar Icon), %tb (Bitmap Button), %tv (Tree Control)) and when format strings must be constructed dynamically under program control.

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited