[futurebasic] Re: [FB] [FB^3r4] Preferences? Telling if it is the First Time a program has been loaded.

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2001 : Group Archive : Group : All Groups

From: Ian Mann <i.mann@...>
Date: Tue, 01 May 2001 10:39:44 +0000

TrohenServices@... wrote:

> Is there a way to tell if the program has been loaded for the first time
> then displays a 1st time pict resource
> and then after that the next time it displays the regular pict resource?
>
> -Brian
>
> --
> To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>

If your program craetes a pref file, you can look for it and if there use PIC2
if it's not there use default prefs and PIC1

CLEAR LOCAL
DIM pbBlk.80
dim FileMissing%
LOCAL FN FileExists% (FileName$ , wdRefNum%)
pbBlk.ioNamePtr& = @FileName$
pbBlk.ioVRefNum% = wdRefNum%
FileMissing% = FN GETFILEINFO (@pbBlk)
END FN = FileMissing%

LOCAL
DIM IsItThere%
DIM sysWDRefNum%
LOCAL FN GetPreferences
gPrefWDRefNum% = FN GetSysFolderVol(_kPreferencesFolderType)
IsItThere% = FN FileExists% (gPrefFileName$ , gPrefWDRefNum%)
LONG IF IsItThere% = 0
FN PrefReadRecord ' Use PIC2
gPicToUse = _NormalPic
XELSE
FN DefaultPrefs
FN PrefWriteRecord'Use PIC1
gPicToUse = _FirstTimePic
END IF
END FN

Regards

Ian