A Demo of loading 32-bit icon LoadPicture and SavePicture functions of VB should have no place in an icon edit program. The former would invariably produce a runtime error if it encounters a 32-bit icon, and the latter cannot even property deal with a 24-bit icon. To correctly handle the icon files (read, save, extract or convert), one must understand the header structures and must have a firm grip on how to deal with the bitmap data arrangements according to the different sizes and color depths of the respective icons, especially the ones with alpha-channel (XP icons). This demo shows how to load a 32-bit icon (you may also try icons of any other color depth). The author sincerely apologies for not being able to address coding questions you might have, owing to his own time constraint. In an icon edit program, one should (i) synchronize the alpha positions in tamdem with the change in pixel posisitions (e.g. when the user rotates the picture); and (ii) provide a separate editing screen for alpha layer. To gain processing speed in an actual application entailing image manipulations, it is advisable to use 32-bit DIBs rather than Picturebox controls (used here for demo only). This is particularly relevant for region dragging operation (to allow the user to move around a selected area). Removal of fallacies (1) Codes pertaining to icon edit/conversion, written a few years ago, are still the same good. Comment: Not necessarily. Chances are that they are no longer good (I myself had to retract the posting of my icon editor code written in 1999). One of the obvious reasons being the advent of 32-bit icons since XP. (2) If Explorer displays the image of an ICO file as icon, that file must be a valid icon file. Comment: Wrong. For a quick test, you can create a BMP file, then rename it with ICO file extension. Explorer would display it as if it is an icon file. (3) One can make use of ImageList and then use SavePicture function to save 32x32 and 16x16 icons. Comment: Incorrect. First of all, one cannot produce a valid 16x16 icon via ImageList. Secondly SavePicture() cannot handle True Color icons. (4) Whilst by now it is well understood that VB LoadPicture cannot be used to load the 32-bit icons (run time would occur), APIs such as DrawiconEx or ExtractIconEx can be used to tackle the issue. Comment: No. The application of the said APIs is specific; it cannot tackle the issue. (Nor the use of CreateIconIndirect or OleCreatePictureIndirect.) |