Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change .ESL Icon using good 'ol native FoxPro 2.x

Program Source Code

How to change .ESL Icon using good 'ol native FoxPro 2.x

by  Scott24x7  Posted    (Edited  )
Copy and past the code below into a .PRG file, I like to call it FIXICON.PRG, but that is up to you. You will need to change the name of the Icon file (as designated by the .ICO file name) in line 17, and the path to your .ESL file in line 19. Then, compile, and run, and like magic, you'll have a new Icon that represents your overall application, and that silly Fox Head will disappear.
Note: That I don't recommend using Icons that are greater than 16x16, or that use High Color definitions. FPW was created back in the day before such things, and I have had *unusual* (at best) experiences with icons over 256 colors, or 32x32.
Make sure you back up your .ESL file before applying this Icon code. (You never know what might happen...)

* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* FIXICON.PRG: Replace Icon in Fox 2.x ESL
* Author: Scott Payton
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CLEAR
CLOSE ALL
*
PRIVATE M.LC_ESLIcon
PRIVATE M.LC_FoxIcon
PRIVATE M.LC_NewIcon
*
M.LC_NEWIcon = ""
M.LC_FoxIcon = ""
M.LC_ESLIcon = Read_Icon( "\ICONS\MYICON.ICO", 126, @m.LC_NEWIcon )
*
=Updt_Icon("\MYAPP\FOXW2600.ESL", 175720, m.LC_NewIcon)
*
CLOSE ALL

* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * *

FUNCTION Updt_Icon

PARAMETER PC_Name, PN_Offset, PC_Buffer
*
PRIVATE M.LN_Handle
*
M.LN_Handle = FOPEN( m.PC_Name, 2 ) && Read/Write Buffered.
*
IF M.LN_Handle < 0 && If open not successfull...
?? CHR( 7 )
WAIT WINDOW m.PC_Name + " Open error: " + STR(FERROR())
RETURN .F.
ENDIF
*
=FSEEK(M.LN_Handle, M.PN_Offset)
*
=FWRITE(M.LN_Handle, M.PC_Buffer, 512)
*
=FCLOSE(M.LN_Handle)

* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * *

FUNCTION Read_Icon

PARAMETER M.PC_Name, M.PN_Offset, M.PC_Buffer
*
PRIVATE M.LN_Handle
*
M.LN_Handle = FOPEN(M.PC_Name)

IF M.LN_Handle < 0 && If open not successfull...
?? CHR( 7 )
WAIT WINDOW m.PC_Name + " Open error: " + STR(FERROR())
RETURN .F.
ENDIF
=FSEEK(M.LN_Handle, M.PN_Offset)
*
M.PC_Buffer = FREAD(M.LN_Handle, 512)
*
=FCLOSE(M.LN_Handle)
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top