[futurebasic] Re: [FB] Easy one?

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

From: Chris Stasny <staz@...>
Date: Thu, 28 Jun 2001 08:51:50 -0500
>Hi Martin-
>
>I do it like this to get the user's initials from an STR resource in my
>prefs file. The error trapping sucks, and the selection of the
>preferences folder would make Alain and Jonathon cringe, but I only have
>10 users, so it works :)
>
>prefsFolder% = SYSTEM(_sysVol)'get the system volume
>prefsFolder% = FOLDER("Preferences", prefsFolder%)
>'get the preferences folder (in the U.S. anyway)
>'some day I should fix this so it does it the right way
>gPrefFile% = USR OPENRFPERM("SOS Prefs", prefsFolder%,_fsRdWrPerm)
>'open the preferences resource file
>'you can see how good I am with error trapping
>myHnd& = FN GETRESOURCE(_"STR ",_engInitials)
>'get handle to initials resource
>'_engInitials is a constant with the STR resource number in it
>LONG IF myHnd&
>gEngInitials$ = PSTR$([myHnd&])
>'assign initials to the global variable via a dereferenced handle
>DISPOSHANDLE (myHnd&)'dispose of initials handle when done
>XELSE
>gEngInitials$ = ""'couldn't get the initials
>END IF


Paul,

This will cause your heap to be corrupted. You should not ever use 
disposeHandle of a resource.



Best,

-STAZ  ~)~

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