Partager via


Modify resource file entries

In my prior two posts (This code queries the foxuser resource file. What does it do? and More Resource file data mining), I showed how to read resource file entries.

Here’s code that shows how to modify the entries.

SET RESOURCE ON && make sure Foxuser is being used to store preferences

USE SET("Resource",1) AGAIN ALIAS foxuser

cFilename="testprog.prg"

FOR i = 1 TO 10

      ERASE testprog.prg && start with no file existing

      _cliptext="This is some sample text"+CHR(13)+" More text" && put some text on the clipboard

      KEYBOARD '{CTRL+v}' && put a paste command in the keyboard buffer to paste it in

      MODIFY COMMAND (cFilename) nowait && open an editor window

      DOEVENTS && allow the paste

      KEYBOARD "Y" && put a 'Y' to save changes in the buffer

      RELEASE WINDOWS testprog.prg && Close the edit window

      LOCATE FOR id="WINDMODIFY" AND name=cFilename && find the record in the resource table

      nLeft=INT(VAL(TRANSFORM(CTOBIN(SUBSTR(Data,13,4),"4rs"),"9999")))

      nleft=nleft+1

      ?nLeft

      newdata = LEFT(data,12)+BINTOC(nLeft,"4rs")+SUBSTR(data,17)

      REPLACE data WITH newdata,ckval WITH VAL(SYS(2007,SUBSTR(newdata,3)))

ENDFOR

Comments

  • Anonymous
    May 04, 2006
    The comment has been removed
  • Anonymous
    May 04, 2006
    The comment has been removed