awesome thank you so much
Until Roberto has a chance to modify the thinBasic bundler to allow user-specified icons, here is a simple program that will allow the existing icon to be changed after a bundle has been created.
This routine was created using FBSL version 3, and is based on one originally written by Gerome Guillemin to change the icon on FBSL files. The GUI-based routine is, however, limited to the use of 32x32x16 color (766 byte) icons.
Don
XPS 1710
awesome thank you so much
Don,
works good!
Thank you very much!
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Thanks a lot Don.
To be honest I do not like too much to have a FBSL bundled exe that change an icon in a thinBasic bundled exe, but that's it: we have to survive
Maybe we can make a thinBasic application that does the job. I will study it.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Eros:
I agree with your feelings about using a FBSL program to modify a thinBasic bundled script. I had my own misgivings about this as well, but I needed a way to get the job done and it worked. I must admit that it was pure luck that I stumbled on the capability of this routine to change icons in bundled thinBasic scripts. This was an example of serendipity in action. The only modification I made to the original FBSL procedure was the window title.
Don
XPS 1710
The following thinBasic code does change the icon of whatever EXE.
Again: limitation to 32x32 16 colors icons
Attention: for safety reasons, original exe is never touched and a new exe is created.
Maybe someone would like to add a nice user interface and a better error checking.
Ciao
Eros
[code=thinbasic]
USES "FILE"
USES "UI"
'---binary marker inside the exe used to identify icon position
$IconMarker = chr$(&H28, &H00, &H00, &H00, &H20, &H00, &H00, &H00, &H40, &H00)
%ICONSTART = &h16
%ICONMAXSIZE = &h2FE
'---Ask about EXE file
DIM sExeFile AS STRING
DIM sExeBuffer AS STRING
sExeFile = Dialog_OpenFile(0, "Choose thinBasic bundled EXE", _
DIR_GetCurrent, "Exe (*.EXE)|*.EXE", "EXE", _
%OFN_FILEMUSTEXIST OR %OFN_HIDEREADONLY or %OFN_ENABLESIZING)
if sExeFile = "" then
msgbox 0, "Empty Exe file."
stop
end if
'---Ask about ICO file
DIM sIcoFile AS STRING
DIM sIcoBuffer AS STRING
sIcoFile = Dialog_OpenFile(0, "Choose Icon file", _
DIR_GetCurrent, "ICO (*.ICO)|*.ICO", "ICO", _
%OFN_FILEMUSTEXIST OR %OFN_HIDEREADONLY or %OFN_ENABLESIZING)
if sIcoFile = "" then
msgbox 0, "Empty icon file."
stop
end if
'---Full load EXE and ICO into string buffers
sExeBuffer = file_load(sExeFile)
sIcoBuffer = file_load(sIcoFile)
'---Check the sizeof the ICO
if len(sIcoBuffer) <> %ICONMAXSIZE then
msgbox 0, "Icon is not a 32x32 16 colour icon: " & str$(len(sIcoBuffer)) & str$(%ICONMAXSIZE)
stop
end if
dim lPos as long
Dim iSize as long
'---Determine where inside EXE buffer icon marker is placed
lPos = instr(sExeBuffer, $IconMarker)
if lPos = 0 then
msgbox 0, "Icon position inside EXe file not found."
stop
end if
'---If we are here it means all is ok so make some little tuning ...
iSize = len(sIcoBuffer)
If iSize > %ICONSTART Then iSize = iSize - %ICONSTART
'---...substitute current icon inside EXE buffer with the new icon data
mid$(sExeBuffer, lPos, iSize) = mid$(sIcoBuffer, %ICONSTART+1, iSize)
'---Save the new exe
file_save(sExeFile & ".exe", sExeBuffer)
'---All done.
[/code]
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Thanks Eros.
It seems to be working fine here for me.
Don
XPS 1710
Perfect.
Motivation can let you (me) climb up any ... mountain
Anyhow, I'm not sure if the used method is correct or not, I do not have experience on EXE format.
I just follow FBSL example. Hope it is a safe method.
Ciao
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
PE explorer reports it as an error, so its a hack.
I think the checksum for that chunk needs recalculating.
Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370
Hi Don,Originally Posted by GSAC3
It worked for me on Vista - but just to say if I view folder's contents that contains the changed icon in medium or large icons display then the icon reverts back to the regular thinbasic "box" icon as normal...
Regards,
catventure.
http://tab.thinbasic.com - Home Of The ThinBasic Adventure Builder Project. (Interactive Fiction/Text Adventure Maker)
Bookmarks