[futurebasic] Re: [FB] Invisible file

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

From: Rick Brown <rbrown@...>
Date: Tue, 14 Sep 1999 21:12:38 -0500

Pixmix (micronet) wrote:

> WinGammon@... wrote:
>
> > How do I make a file invisible when it is created?
> >
> > David
> >
>
> David,
>
> You can use this FN. I think  I have adapted it from one of Rick's gifts.
>
> CLEAR LOCAL MODE
> DIM pbBlk.80
> DIM osErr%
> LOCAL FN VisibleFile(visible,filename$, vRefNum%)
>   pbBlk.ioNamePtr& = @filename$
>   pbBlk.ioVRefNum% = vRefNum%
>   osErr% = FN GETFILEINFO (@pbBlk)
>   LONG IF visible
>     pbBlk.ioFinderInfo.fdFlags% = pbBlk.ioFinderInfo.fdFlags% XOR _fInvisible
>   XELSE
>     pbBlk.ioFinderInfo.fdFlags% = pbBlk.ioFinderInfo.fdFlags% OR _fInvisible
>   END IF
>   osErr% = FN SETFILEINFO (@pbBlk)
> END FN = osErr%
>
> Call it like this err = FN VisibleFile(_false,yourFilename$,vRef)
> Cheers
>
> Alain

I would make one change to this FN.  This statement:

pbBlk.ioFinderInfo.fdFlags% = pbBlk.ioFinderInfo.fdFlags% XOR _fInvisible

does not always set the "invisible" flag to false, as was apparently intended:
instead, it just flips the flag to its opposite state.  To make sure the flag
gets set to false (regardless of its initial condition), try this instead:

pbBlk.ioFinderInfo.fdFlags% = pbBlk.ioFinderInfo.fdFlags% AND (NOT _fInvisible)

- Rick