[futurebasic] Re: [FB] Prefs Files -- Icon?

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

From: tatewake@... (TJ Grant)
Date:
>How do I add the preferences document icon to the file that TJ Grant put in
>my Preferences folder? You know, the one with the two radio buttons?

Ah, this is fun too-

Pop this in your project:

_myIoFlFndrInfo = 32
CLEAR LOCAL
DIM pBlock.128
DIM err
DIM oldType&
DIM oldCreator&
DIM attrib
DIM 90 msg$
LOCAL FN ChangeTypeCreator(filename$, vRefNum, theType&, theCreator&)
  pBlock.ioCompletion& = 0
  pBlock.ioNamePtr&    = @fileName$
  pBlock.ioVRefNum%    = vRefNum
  pBlock.ioDirID&      = 0
  pBlock.ioFDirIndex%  = 0
  err = FN HGETFILEINFO(@pBlock)
  LONG IF err = _noErr
    oldType&    = pBlock.myIoFlFndrInfo.fdType&
    oldCreator& = pBlock.myIoFlFndrInfo.fdCreator&
    LONG IF theType& <> oldType& OR theCreator& <> oldCreator&
      attrib = PEEK(@pBlock + _ioFlAttrib)
      SELECT CASE
        CASE (attrib AND BIT(0)) <> 0             'file is locked
        CASE (attrib AND BIT(7)) <> 0             'file is already open
        CASE ELSE
          pBlock.myIoFlFndrInfo.fdType&    = theType&
          pBlock.myIoFlFndrInfo.fdCreator& = theCreator&
          err = FN SETFILEINFO(@pBlock)

      END SELECT
    END IF
  XELSE
    BEEP
  END IF
END FN = err

Then you can say something like this:

OsErr% = FN ChangeTypeCreator(myFileName$, lvref%, _"pref", _"????")

You will substitue _"????" for something similar- a 4 character creator
type that you will create from scratch. Now the icon will not show up with
the radio buttons like you expect to happen. For this, you will use a
program like resedit to create a resource file. Refer to the FB manual for
this; the resources section.



-- TJ Grant (tatewake@...)
Inspired Communications. http://inspired.netstreet.net/
Phone: 407-728-7563