[futurebasic] Re: [FB] re: Unalterable Text Resources?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1999 : Group Archive : Group : All Groups

From: Chris Stasny <staz@...>
Date: Wed, 17 Nov 1999 11:37:29 -0600
Let me make some simple suggestions to tedd's text resource question.

1 Set a variable to zero:

gCheckSum = 0

2 Store the old res file and switch to the app:

currRes = FN CURRESFILE
CALL USERESFILE SYSTEM(_aplRes)

3 Count all text resources

count = FN COUNT1RESOURCES(_"TEXT")

4 loop thru all and checksum

FOR x = 1 TO count
  rHndl& = FN GET1INDRESOURCE(_"TEXT",x)
  LONG IF rHndl&
    size& = FN GETHANDLESIZE(rHndl&)
    FOR loop& = 0 to size& - 1
      gCheckSum = gCheckSum + PEEK([rHndl&]+loop&)
    NEXT
  END IF
NEXT

5 restore the res file

CALL USERESFILE currRes

6 Store the checksum (as a resource?) in your application.

Note: You want to do this when the application flag is _false. In other
words, when you are running interactive, this routine should run
automatically. It shouldn't take it more than a half second or so to calc
the check sum.

When the application flag is true, you want to go thru the same procedure,
except that this time you compare the checksum that you just calculated to
the stored version.

Another note: gCheckSum is an integer and will be over run many times.
That's OK. It's still a checksum.

Another note: it doesn't matter if you have style information or not. In
fact, you don't have to do this on _"TEXT" resources, you could pick any
kind.



Best,

-STAZ  ~)~

800.348.2623 Orders  http://www.stazsoftware.com
228.255.7086 FAX     mailto:staz@...