Re: win32lib, LV's and icons
- Posted by cafromsw at yahoo.com Jan 13, 2003
- 514 views
I have just found out that my createIconEx() routine isn't working under Win98. I have tested it on WinME and on WinXP, and it seems to run ok on those platforms. As soon as I get a system loaded with 98 I will try to figure out and fix the problem. Chris cafromsw at yahoo.com --- cafromsw at yahoo.com wrote: > > Wolf pointed out to me that I was incorrectly use > peek4signed when I should have been using > peek4unsigned which could have caused some problems > with error checking, thanks. I also realized that > my > extractIconEx didn't cohabitate with win32libs > addIcon(extractIcon()) pair. I have slightly > rewritten the routine to take both of these things > into account. It can still be found here; > http://home.attbi.com/~sea.star/code/lvextras.ew > I have converted the tabs to spaces so it should > copy > better now, or a right-click save would work. As > before it need to be pasted into win32lib.ew. I will > also paste it into this post per Dan's suggestion. > Yahoo mail has a really narrow text box for writing > emails so it breaks the lines in wierd places. I > have > also rewritten the routine to test extractIconEx. > It > now calls addIcon(extractIcon()) then > extractIconEx() > so you can see the difference between the two calls. > > Any problems or suggestions are always welcome. > Chris > cafromsw at yahoo.com > > --paste into win32lib.ew-------------- > -- Version 2003.01.12a CMA > -- Routines to extract both large (32x32) and small > (16x16) icons from .ico, .dll and .exe files > -- for use in ListViews that need both sizes. Can > also be used as a replacement for > -- NewIco &= addIcon(extractIcon({"shell32.dll",1})) > -- Example: > -- NewIco &= extractIconEx({"shell32.dll", 1}) > -- both examples return an index to the image list > for > use in ListViews etc. > -- can be used as a replacement for or in conjuction > with addIcon(extractIcon()) > > > global constant > xExtractIconEx = registerw32Function(shell32, > "ExtractIconEx", {C_POINTER, C_INT, C_POINTER, > C_POINTER, C_INT}, C_INT) > > --global function extractIcon( sequence Filename ) > > -- REM'd by CMA 1.10.03 > global function extractIconEx( sequence Filename ) > > -- added by CMA 1.10.03 > atom icon > > -- REM'd by CMA 1.12.03 > integer lIdx > > atom lgico, smico > > -- added by CMA 1.10.03 > object hIcon > > -- added by CMA 1.12.03 > > lIdx = 0 > if length(Filename) > 0 then > if sequence(Filename[1]) then > lIdx = Filename[2]-1 > Filename = Filename[1] > end if > end if > > lgico = acquire_mem(0, Long) > > -- added by CMA 1.10.03 > smico = acquire_mem(0, Long) > > -- added by CMA 1.10.03 > hIcon = w32Func( xExtractIconEx, {Filename, lIdx, > lgico, smico, 1} ) -- added by CMA 1.12.03 > if hIcon > 0 then > > -- added by CMA 1.12.03 > ILAddIcon( ILlarge, peek4u(lgico) ) > > -- added by CMA 1.10.03 > ILAddIcon( ILsmall, peek4u(smico) ) > > -- added by CMA 1.10.03 > ilicon_list &= hIcon > > -- added by CMA 1.12.03 > end if > > -- added by CMA 1.10.03 > release_mem(lgico) > <snip>