i want to learn the basics of images in win32. id just like to add a standard Windows icon to an image list and then use that image list with my treeview control. can someone help? no mfc please.
i want to learn the basics of images in win32. id just like to add a standard Windows icon to an image list and then use that image list with my treeview control. can someone help? no mfc please.
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
i tried it on my own while waiting for some gracious soul to reply to this post(which hasn't happened), and i had troubles setting the image list to the tree view control. code:
the last line of code returns NULL. what have i done wrong?Code:HBITMAP hBit; HIMAGELIST hList; hBit=(HBITMAP)LoadImage(NULL,"icon.ico",IMAGE_ICON,0,0,LR_LOADFROMFILE); hList=ImageList_Create(16,16,ILC_COLOR,1,0); ImageList_Add(hList,hBit,NULL); TreeView_SetImageList(hwndTree,hList,TVSIL_NORMAL);
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
i found out some more stuff. i can load in a bitmap, but not an icon. ie, not a .ico file. heres the icon code that doesn't work.
after that code, i check the image count in the list, and there's nothing there, but it works fine with a normal bitmap. does that help anyone to help me?Code:HBITMAP hBit; HIMAGELIST hList; hBit=(HBITMAP)LoadImage(NULL,"gta3.ico",IMAGE_ICON,32,32,LR_LOADFROMFILE); hList=ImageList_Create(32,32,ILC_COLOR,1,1); ImageList_Add(hList,hBit,(HBITMAP)NULL);
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
I'm not experienced with image lists but try LoadIcon
__ &n bsp; ___ & nbsp; &nb sp;   ;
/\ \ __ &nbs p; /\_ \   ; & nbsp;
\_\ \/\_\ ____ _ __\//\ \ __ __&n bsp; __
/'_` \/\ \/\_ ,`\ / __`\\ \ \ /\ \/\ \ /'__`\
/\ \_\ \ \ \/_/ /_/\ \_\ \\_\ \_\ \ \_/ |/\ __/
\ \___,_\ \_\/\____\ \____//\____\\ \___/ \ \____\
\/__,_ /\/_/\/____/\/___/ \/____/ \/__/ \/____/
&n bsp; I have a BAD figlet& nbsp;addiction.
loadicon is for loading resources. i want to load directly from an .ico file. someone must know how to do it.
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
oops i posted twice. the second one is updated.
Last edited by bennyandthejets; 01-09-2003 at 10:20 PM.
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
ok, i gave in and made the icon a resource. now i cant work out how to load the resource. i loaded it successfully with loadicon when i made it the hIcon of the window class, but i couldn't get loadicon OR loadimage to work when i tried to add it to an image list.
No image is added to the list.Code:HBITMAP hBit; HIMAGELIST hList; hBit=(HBITMAP)LoadImage(hInst,(LPCTSTR)IDI_APP,IMAGE_ICON,16,16,NULL); hList=ImageList_Create(16,16,ILC_COLOR,1,1); ImageList_Add(hList,hBit,(HBITMAP)NULL);
???
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
What about ImageList_AddIcon()?
ImageList_AddIcon(HIMAGELIST himl, HICON hicon);
Staying away from General.
yeah that turned out to be the one. i looked through my win32 reference, and surprise surprise, addicon appears. i feel like real jerk .
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials