1. Help with Windows API ImageList_LoadImage needed
- Posted by 1evan at sbcglobal.net Aug 19, 2003
- 905 views
Using the following definitions, when I call ImageList_LoadImage, it always gives me "Image not loaded." Any ideas why? Do I not have something defined correctly? MyIcon.ico is a 16x16 icon. ImageList_LoadImage = link_c_func(comctl, "ImageList_LoadImage", {C_INT,C_POINTER,C_INT,C_INT,C_UINT,C_UINT,C_UINT},C_INT) CLR_DEFAULT = #FF000000 LR_LOADFROMFILE = #0010 Image = allocate_string("MyIcon.ico") if not c_func(ImageList_LoadImage,{NULL,Image,16,1,CLR_DEFAULT,1,LR_LOADFROMFILE}) then puts(1,"Image not loaded" & '\n') end if
2. Re: Help with Windows API ImageList_LoadImage needed
- Posted by euman at bellsouth.net Aug 20, 2003
- 920 views
On 20 Aug 2003 at 4:04, 1evan at sbcglobal.net wrote: > Using the following definitions, when I call ImageList_LoadImage, it > always gives me "Image not loaded." > Any ideas why? Do I not have something defined correctly? MyIcon.ico > is a 16x16 icon. > > ImageList_LoadImage = link_c_func(comctl, "ImageList_LoadImage", > {C_INT,C_POINTER,C_INT,C_INT,C_UINT,C_UINT,C_UINT},C_INT) > > CLR_DEFAULT = #FF000000 > > LR_LOADFROMFILE = #0010 > > Image = allocate_string("MyIcon.ico") > > if not > c_func(ImageList_LoadImage,{NULL,Image,16,1,CLR_DEFAULT,1,LR_LOADFROMFILE}) > then > puts(1,"Image not loaded" & '\n') > end if > Im not sure what you're doing here but Ive always loaded my ImageList like so: hImageList = c_func(xImageList_Create,{16,16,ILC_COLOR16,2,10}) hBitmap = LoadImage("image.bmp", IMAGE_BITMAP) junk = c_func(xImageList_Add,{hImageList,hBitmap,NULL}) c_proc(xDeleteObject, {hBitmap}) using standard LoadImage instead of ImageList_LoadImage This has always worked for me. Take a look at my EFFM project in the RDS archive... http://www.rapideuphoria.com/effm2.zip Treeview.ew loads a user created imagelist from file Hope this will help.. Euman
3. Re: Help with Windows API ImageList_LoadImage needed
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 20, 2003
- 856 views
On Wed, 20 Aug 2003 04:04:41 -0700 (08/20/03 21:04:41) , <1evan at sbcglobal.net> wrote: > > > Using the following definitions, when I call ImageList_LoadImage, it > always gives me "Image not loaded." > Any ideas why? Do I not have something defined correctly? MyIcon.ico is > a 16x16 icon. Maybe "MyIcon.ico" is not in the current directory. You don't specify a path to it in the allocate_string() so it would be looking for it in the current directory. -- cheers, Derek Parnell
4. Re: Help with Windows API ImageList_LoadImage needed
- Posted by 1evan at sbcglobal.net Aug 20, 2003
- 884 views
Thanks, I already decided that LoadImage was the way to go. Not really sure of what I'm doing either . Just trying to load some images in an Image List and put those images on tool bar buttons. I seem to be alright in creating the Image List now. Now if I could just get the buttons on the tool bar! euman at bellsouth.net wrote: > > >On 20 Aug 2003 at 4:04, 1evan at sbcglobal.net wrote: > > >>Using the following definitions, when I call ImageList_LoadImage, it >>always gives me "Image not loaded." >>Any ideas why? Do I not have something defined correctly? MyIcon.ico >>is a 16x16 icon. >> >>ImageList_LoadImage = link_c_func(comctl, "ImageList_LoadImage", >>{C_INT,C_POINTER,C_INT,C_INT,C_UINT,C_UINT,C_UINT},C_INT) >> >>CLR_DEFAULT = #FF000000 >> >>LR_LOADFROMFILE = #0010 >> >>Image = allocate_string("MyIcon.ico") >> >>if not >>c_func(ImageList_LoadImage,{NULL,Image,16,1,CLR_DEFAULT,1,LR_LOADFROMFILE}) >>then >> puts(1,"Image not loaded" & '\n') >>end if >> >> >Im not sure what you're doing here but Ive always loaded my ImageList like so: > >hImageList = c_func(xImageList_Create,{16,16,ILC_COLOR16,2,10}) >hBitmap = LoadImage("image.bmp", IMAGE_BITMAP) >junk = c_func(xImageList_Add,{hImageList,hBitmap,NULL}) >c_proc(xDeleteObject, {hBitmap}) > >using standard LoadImage instead of ImageList_LoadImage >This has always worked for me. > >Take a look at my EFFM project in the RDS archive... >http://www.rapideuphoria.com/effm2.zip >Treeview.ew loads a user created imagelist from file > >Hope this will help.. > >Euman > >--^---------------------------------------------------------------- >This email was sent to: 1evan at sbcglobal.net > > >TOPICA - Start your own email discussion group. FREE! > >
5. Re: Help with Windows API ImageList_LoadImage needed
- Posted by 1evan at sbcglobal.net Aug 20, 2003
- 872 views
hi : This parameter can be NULL if you are loading an image from a file (which I am). lpbmp: If the /uFlags/ parameter includes LR_LOADFROMFILE (which it does), /lpbmp/ is the address of a null-terminated string that names the file containing the image to load. (which it is). If /hi/ is NULL and LR_LOADFROMFILE is not specified (but it is), the low-order word of this parameter must be the identifier of an OEM image to load. I believe Robert Craig wrote that the C_ types were identical in how they were handled, except for C_DOUBLE. COLORREF might need to be a double, I'm not sure. Anyway, I decided to go with LoadImage instead. Thanks for your advice, though. Al Getz wrote: >ImageList_LoadImage = link_c_func(comctl, "ImageList_LoadImage", >{C_INT,C_POINTER,C_INT,C_INT,C_UINT,C_UINT,C_UINT},C_INT) > >CLR_DEFAULT = #FF000000 >LR_LOADFROMFILE = #0010 >Image = allocate_string("MyIcon.ico") >c_func(ImageList_LoadImage,{NULL,Image,16,1,CLR_DEFAULT,1,LR_LOADFROMFILE}) > > >Hello there, > >For that particular function you need to check your types in the >function link as well as note the following: > >hi (very first parameter of this function) > >Handle to the instance that contains the resource. >If the hi parameter is zero, the low-order word of this parameter must >be the identifier of the OEM image to load. The OEM image identifiers >are defined in WINUSER.H. Following are the identifier prefixes and >their meanings: > >Prefix Meaning >OBM_ OEM bitmaps >OIC_ OEM icons >OCR_ OEM cursors > >Take care, >Al > >--^---------------------------------------------------------------- >This email was sent to: 1evan at sbcglobal.net > > >TOPICA - Start your own email discussion group. FREE! > >
6. Re: Help with Windows API ImageList_LoadImage needed
- Posted by 1evan at sbcglobal.net Aug 20, 2003
- 871 views
No, it's in the current directory. I checked by opening it in the program, seeing if I got a handle for it, then closed it. I went to LoadImage and that seems to be working for me. Thanks for taking the time to respond. Derek Parnell wrote: > > On Wed, 20 Aug 2003 04:04:41 -0700 (08/20/03 21:04:41) > , <1evan at sbcglobal.net> wrote: > >> >> Using the following definitions, when I call ImageList_LoadImage, it >> always gives me "Image not loaded." >> Any ideas why? Do I not have something defined correctly? >> MyIcon.ico is a 16x16 icon. > > > Maybe "MyIcon.ico" is not in the current directory. You don't specify > a path to it in the allocate_string() so it would be looking for it in > the current directory. > >