Yes, you can add images (or icons) to the image list one at a time.
ImageList_AddMasked returns the index# of the added image. Since I load
the bitmap file during compilation, it's easier to load a single file.
PNG files (or any other format) will need to be converted to the BMP
format. The simple Paint program supplied with Windows can Save As into
the BMP format.
ImageList_Add requires the handle to two bitmaps, one the image, the
other a mask. ImageList_AddMask requires a single image bitmap handle
plus a mask (background) color. It then derives the mask bitmap from
the image bitmap.
Lastly, as SwiftForth is not compiled from scratch, there is no support
for "resources". There are other ways to access items normally stored
in the resource area. For example, ExtractIcon can be used for icon
files.
Mike
-----Original Message-----
From: sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com] On Behalf
Of Douglas Reid
Sent: Thursday, May 06, 2010 8:49 AM
To: sftalk_at_forth.com
Subject: [sftalk] Re: Image List
Thanks, Mike.
This looks like a reasonable approach.
It is interesting how you use a single bit map consisting of multiple=20
images.
I shall try it this evening.
(First I have to think about how to actually produce such composite
images=20
...)
My approach was based on using potentially multiple calls to
ImageList_Add=20
(although only 1 shown in my example) to load a series of files .bmp,
.ico=20
or whatever.
In that respect, my approach (which is that seen in most of the MSDN and
other C examples) is useful.
The programme would only need to deal with each single small image at a
time=20
rather than dealing with a potentially large bmp file.
Each of the many image or icon source files could potentially have
different=20
characteristics that could be passed/ dealt with in the file upload
process.
For example, (just for fun!) I was going to try to use a collection of=20
country flags I found on the web.
They are provided as UK.png, US.png, etc. [I hope png format will be
okay=20
... ?! Maybe these Windows functions convert them to a bmp bit map?]
I already have countries and codes in a tabular list so was intending to
process for each country in turn
200 0 DO ... ImageList_Add ... LOOP
No doubt it is possible, with some thought, to first create the large
bmp=20
file based on all the countries programmatically and then use your
approach=20
to upload them in one go. However, doing that programmatically would=20
require a similar approach to what isn't working - i.e., using multiple=20
calls of LoadImage and ImageList_Add.
The question remains as to what is wrong with my code.
My use of LoadImage (or the more specific/ older LoadIcon/ LoadBitmap=20
variants) has the same objective as your step 4.
4) Get a handle to your bitmap file
The handle is hImage in my code example
By this step, I am seeing large numbers that appear to be handles
Failure (-1 returned) is only seen at the next step when ImageList_Add
is=20
used.
Actually, ImageList_Add and ImageList_AddMasked appear very similar -=20
apparently both can be used with 1 or more images.
So, there is little difference between our approaches - apart from the
fact=20
that mine isn't working :-(
The other open question remaining is the use of standard resources -
i.e.,=20
how to load pre-defined system icons.
Also, how does one create own resources such as was done to produce the=20
SwiftForth icon that can be used as a component in any programme simply
by=20
referring to them as a number
NULL 101 LoadIcon
What is the approach used to associate constants with own icons?
Best Regards,
Douglas
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Thu May 06 2010 - 09:13:18 PDT
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 06-Feb-2012. Archive updated nightly.