Re: [VB6] Icon Resource Organizer
Re "3" of my earlier posting. Even if it is a "straight" 32-BPP image, once converted to 24-BPP (or below), the original parts with "alpha effects" of which mostly along the edges of the image (so called "edge smoothing"), which was originally intended to be blended in to whatever the background colors, have now become fixed, i.e. bound to a color or colors present when one does the conversion. Later on, when one places the resultant image against a background of different color(s), the said parts (edges) would appear "out of place". Do one and try to use a Fill tool to fill the transparent parts with a different color in turn, one will see the ugly edges clearly then.
Re: [VB6] Icon Resource Organizer
Thanks for the information. I don't have much knowledge about 24bbp and 32bbp. Normally I use convertico.com to convert PNG images to ICO and it does a pretty good job. Depending on the size of the PNG it creates a 32bpp 256x256, 128x128, 64x64, 48x48, 32x32, 16x16 icon. I was just wondering if it could be done with VB6.
2 Attachment(s)
Re: [VB6] Icon Resource Organizer
(1) I have tested convertico.com with a 256x256 32-BPP PNG, and obtained a multi-icon file containing 32-BPP icons of assorted sizes as you said. Not bad. However, professionally speaking, there is a great defect that you might not be aware of -- the masks are all entirely black (see image below). The icons merely reply on the alpha values to show the images (just like any other 32-BPP non-icon files,.e.g. 32-BPP TGA or 32-BPP TIFF, thus killing the "icon" sense). In this connection, Icon Resource Organizer does the job properly on the other hand -- if you feed the same PNG, you get a proper icon file from it (mask properly done, see image below also), and I have not the least doubt that La Volpe can properly save the image to 32-BPP icons of any size if he bothers to.
I upload a zip file which contains the said PNG file, together with the resulting ICO file, in case you or other readers would like to examine it.
(2) Please be rest assured that VB6 is fully capable of creating a full-featured Icon Editor (without using any extrinsic control or any third party library). If you want to be fully convinced in this respect, just drop me a email and I will let you try out a professional Icon Editor which is created purely with VB6 (good on all Windows platforms from Win95 to Windows 7, 32 or 64-bit, and currently there are registered users in over 30 countries).
1 Attachment(s)
Re: [VB6] Icon Resource Organizer
I believe you that it can be done with VB6. I'm not sure how you check if the mask has been done properly, but below is an icon I created with Icon Resource Organizer. I took your PNG file and resized it to 128x128, 64x64, 48x48, 32x32, 16x16 with GIMP (freeware image editor) and then used Icon Resource Organizer to create a single icon.
Re: [VB6] Icon Resource Organizer
I've verified that all icons in your file are done properly, e.g. the masks and the entries in the header.
You should be able to see the mask image on the edit screen of a reasonably good icon editor. Why is the mask image to be presented on screen, as and when the user edits the image? To visually facilitate the edit (to distinguish painted areas from transparent areas, and vice versa, if it happens a paint color being applied is the same as the "screen color" used by the program). Painted areas are seen as black on mask, transparent parts white.
Re: [VB6] Icon Resource Organizer
Re: [VB6] Icon Resource Organizer
Freeware IcoFX had been mentioned in a couple of postings in this thread, so I've now tried it as well. Indeed, it is technically a proficient program (and I am impressed). However, there is a particular arrangement which I feel strongly against, for reasons which I would try to explain.
In the Toolbox, along with the paint tools, there is an Opacity tool which is meant to set alpha values. It is the points arising therefrom that I want to talk about, as most readers of this forum might not understand the implications of using the said toolbox.
Under the said arrangement, e.g. to arrive at a desired degree of "redness" of a "red" color, the user can (a) select the wanted color and paint it over and/or (b) paint a red color of an arbitrary "redness", then apply an alpha value to adjust it. If we use a mathematical expression, it is like: 100 - 20 = 80 whereas "100" denotes the color without alpha effect, "20" the alpha value and "80" the result. In this case, the image presented on the edit screen is the "80". As long as we get "80", it doesn't matter how "100" and "20" are being varied between them -- such a concept is fallacious.
To cut down the description of the said fallacy, imagine you have a picture of a Japanese flag with a perfect round shape in "red" (symbolizing the Sun) and you are to edit the edges of the painted areas, in order to make the picture look smoother. So you begin to dither the colors at some spots, sometimes you use a paint tool, at other times the Opacity tool, until you are satisfied. However, later on you might find that:
-- On a machine which does not have the capability of showing alpha effects, the picture now looks much worse than before (no longer all of "100" values, in some adjacent spots, some "100", then "50", then "80" and then "20", and so on.)
-- On another machine which is capable of showing the alpha effects, the picture now looks not the same good as you originally determined. This is because, you were only visually satisfied with the combination of the painted color and the background color existing at the time you did the edit, given the "opacity" (alpha) values you set. But the background colors are different now!
-- In either machine, some ghost spots may appear. This is caused by your applying some "opacity" paints in some transparent areas, unintentionally (but have thus been made non-transparent by the program).
Conclusion comment: A proper approach should be to edit alpha values in a separate screen, specifically geared for that purpose (i.e. to change the alpha values only, not the paint values themselves). This means in the paint edit screen, the undiluted colors, i.e. the "100" ones, should be presented, not the "80" ones. Of course the user should be able to inspect the picture with alpha effects any time he/she wants, e.g. by holding down a button or by invoking another screen.
Re: [VB6] Icon Resource Organizer
Question;
With Windows 7 the taskbar icons by default are larger than the titlebar icon. Not sure of exact size, 32x32 or 48x48? Anyway is it possible for a VB6 form to show 1 icon in the titlebar and another in the taskbar?
I have your example code working fine for me, I have an icon with 16x16, 24x24 and 32x32 icons in it. However in my taskbar all I get is a stretched version of the 16x16 icon.
One possibility is my windows icon cache may need clearing, but just wanted to check if it's actually possible to do.
Re: [VB6] Icon Resource Organizer
Edited: An idea. The icon used when Alt+Tab is pressed is generally 48x48 ish. Maybe that is the icon being used in the taskbar. If so, here is a way to set that icon, example is on PSC.
And if the above workaround fails, try this. Use that same code for the ALT+TAB window and apply to your form's hWnd.
And if that doesn't work then... subclassing the form may be the only way. When the icon is requested, a message is sent WM_GETICON and asks for the handle of the large or small icon. VB may not create a large icon; therefore, it stretches the small icon to large when large icon is asked for. That's a guess. But with subclassing, then that message can be intercepted and a proper icon can be provided.
I don't own Win7, so I can't play.
2 Attachment(s)
Re: [VB6] Icon Resource Organizer
Two minor points, as a matter of interest:
(1) I created 2 simple images for my own thumbnail testing on WinME, both with a thin rectangle in red color painted on white background. One image is bigger than the targeted thumbnail size, the other is smaller. My testing shows that there is no way for me to StretchBlt the bigger image (in DIB) onto the thumbnail (in PictureBox) without some missing parts of the painted rectangle, with HalfTone or ColorOnColor. (As a result, I have to resort to using GDIplus in order to maintain the original image intact in the thumbnail.)
It just occurred to me to take a look of your Icon Resource Organizer -- to see how it would perform on Vista for the above-said bigger image. Since the program wouldn't allow it due to its size, I then tried the smaller size one anyway.
Because Icon Resource Organizer showed most parts of the originally red rectangle as black, I thought you might want to take a look of it. The image is contained in the attached ZIP.
(2) I also did a test of the Save function of Icon Resource Organizer, on a Windows Shell32.dll file. After loading the file, I selected "Sort By Original Resource" menu option. I intended to highlight all the items pertaining to an Icon Group and save them to a single ICO file. However, I found that I had difficulties to arrive at what I intended, because not all the said items are in adjacent places, neither on the list nor on the thumbnail screen.
To explain what I've said above, I am attaching two screenshots.
The top one is from my own gadget -- it shows Group 311 is the one I intended to save, comprising 15 items as listed on the right hand side.
The next one is from Icon Resource Organizer. As can be seen, only 6 items belonging to the said Group are shown adjacent to each other.
I know this is not the fault of Icon Resource Organizer itself; I just want to bring out the point in existence, in case you are not aware of it.
.
Re: [VB6] Icon Resource Organizer
Petersen, I have no idea what you are saying or suggesting.
I don't have Win7 and therefore don't have the shell32 for that system. I'm not concerned about "groups". If the project shows all the images from the resource, them I'm comfortable with it; and it appears it does: 3,284 images. If you are talking about any issues regarding larger images not rendered resized with high quality, then by all means, add a call to GdipSetInterpolationMode before drawing. The project is designed to organize and extract. Unless a bug is reported, I've already mentioned I am not enahncing this project. The project does not resize icons that are extracted anyway. Icons are extracted, not modified, as they exist in the resource (exception being with some non-icon/cursor images).
Attaching a full size screenshot of your app looks more like advertising it ;)
P.S. Organizing by RT_GROUP_ICON is a nice touch. You may want to post your project?
1 Attachment(s)
Re: [VB6] Icon Resource Organizer
Re Point "1". I just wanted to point out, with specific sample file supplied in ZIP, that there is a glitch in Icon Resource Organizer. The originally painted rectangle per file attached is Red, but shown as Black on Icon Resource Organizer, per screenshot shown below.
Re Point "2". I meant that when we retrieve icons from Icon Resource File such as Windows Shell32.dll, if we go by RT_GROUP_ICON (i.e. 14&) instead of RT_ICON (i.e. 3&), then icons pertaining to the same group are obtainable. If we only go by RT_ICON, we are still able to obtain individual icons in total count, but items belonging to the same group are scattered in different places. I use Win7 Shell32.dll here becuase it explains better, at least I thought so -- e.g. in this specific example I showed, among the 15 icons there are actually 3 "256x256" PNG items of the same image, but they do not appear in adjacent places in Icon Resource Organizer.
Edited: The image shown in my previous posting is big because it is the actual size, i.e. 256x256.
.
Re: [VB6] Icon Resource Organizer
Point #1. No sample file in zip. A gif with a red rectangle. What use is that really? The actual icon might be of better use I'd think. Anyway, unless I can test it against the same icon you used, I can't determine if a bug exists. If I find a bug, I'd definitely want to fix it. The knowledge learned may apply to other projects I've written and/or apply to future projects.
Point #2. The project does not group. It retrieves icons/cursors as first come first served. I mentioned that I thought grouping was a nice touch, but am not interested in modifying this project. It was provided as-is.
1 Attachment(s)
Re: [VB6] Icon Resource Organizer
Isn't there a menu in Icon Resource Organizer saying it "Append......GIF ....."?
.
Re: [VB6] Icon Resource Organizer
Were you talking about a gif or icon? If your source was a gif, then GDI+ loaded it. We already know there are issues with some GIFs and GDI+. This may be the situation? If so, so be it. I'll take a look tomorrow. I've shut down my VB box for the night.