Saving icons in .ico files (updated to include cursors)

Share your advanced PureBasic knowledge/code with the community.
Mr Coder
User
User
Posts: 54
Joined: Tue Apr 13, 2010 8:02 am

Re: Re:

Post by Mr Coder »

Thanks srod, works without the Purifier spitting the dummy now. ;)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Re:

Post by srod »

Mr Coder wrote:Thanks srod, works without the Purifier spitting the dummy now. ;)
Glad it worked out.

It was a bit 'slack' of me not to fix the bug earlier since I'd known about it for several months now.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Saving icons in .ico files (updated to include cursors)

Post by srod »

Hi,

assuming you mean multiple icons as opposed to icons saved in the latest format, then my code will not do that as it stands. However, I seem to recall that Netmaestro posted some code somewhere which will do this. I cannot remember if he based his code on my routine or he started from scratch?

Worth a search through these forums.
I may look like a mule, but I'm not a complete ass.
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Saving icons in .ico files (updated to include cursors)

Post by c4s »

As far as I understand it's pretty easy:
- In line 83 you already commented "WriteWord(file,1) ;***CHANGE IF EXTENDING CODE TO MORE THAN ONE ICON***", so this should be changed to the number of to be included icons
- Then simply write the following ICONDIRENTRY, BITMAPINFOHEADER and the data for each icon.

... I didn't test it but it should work.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Saving icons in .ico files (updated to include cursors)

Post by srod »

Yes shouldn't be difficult to alter, but I am pretty sure that Netty has already done the job! :)
I may look like a mule, but I'm not a complete ass.
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: Saving icons in .ico files (updated to include cursors)

Post by Thorsten1867 »

TODO (maybe!)
; -Extend the code to save multiple icons/cursors in the same .ico file.
??? :wink:
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Post Reply