I was starting to write a small utility and decided to use the
new DISPLAY OPENFILE along with the new CLASS stuff and ended up
with a nice neat package I will use whenever I need to read the
contents of a file into a buffer. I just like the way it's all nice
and neat in a couple of reusable classes.

James

Code:
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
'SED_PBWIN
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*


#IF NOT %DEF(%Prop_MACROS)
    %Prop_MACROS = 1
    MACRO PropGet(PropName,PropType)=PROPERTY GET PropName() AS PropType:PROPERTY=PropName:END PROPERTY
    MACRO PropSet(PropName,PropType)=PROPERTY SET PropName(BYVAL param AS PropType):PropName=param:END PROPERTY
#ENDIF
'Return Nacros
#IF NOT %DEF(%RET_M_MACRO)
    %RET_M_MACRO = 1
    MACRO Ret_M(RetVal) = METHOD=RetVal:EXIT METHOD
#ENDIF
#IF NOT %DEF(%RET_F_MACRO)
    MACRO Ret_F(RetVal) = FUNCTION=RetVal:EXIT FUNCTION
    %RET_F_MACRO = 1
#ENDIF
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
CLASS cFileOpen
	INSTANCE FileName,Folder,Filter,Start,DflExt,Title AS STRING
	INSTANCE hParent,Flags AS DWORD
	CLASS METHOD CREATE
		Filter = CHR$("All Files",0,"*.*",0)
		Flags = %OFN_EXPLORER OR %OFN_FILEMUSTEXIST
	END METHOD
	INTERFACE iFileOpen : INHERIT IUNKNOWN		
		PropSet(FileName,STRING)
		PropSet(Folder,STRING)
		PropSet(Filter,STRING)
		PropSet(hParent,DWORD)
		PropSet(DflExt,STRING)
		PropSet(Start,STRING)
		PropSet(Title,STRING)
		METHOD GetName() AS STRING
			DISPLAY  OPENFILE hParent,,,Title,Folder,Filter,Start,DflExt,Flags TO FileName
			METHOD = FileName			
		END METHOD
	END INTERFACE
END CLASS
'==============================================================================
CLASS cTextInBuffer
	INSTANCE sFileName,sBuffer AS STRING
	INTERFACE iTextInBuffer : INHERIT cFileOpen,iFileOpen
		METHOD Fill(OPT FName AS STRING) AS STRING
			LOCAL ff AS LONG
			IF ISMISSING(FName) THEN
				sFileName = MYBASE.GetName
			ELSE
				sFileName = FName	
			END IF
			IF ISFILE(sFileName) = 0 THEN
				? "Could not locate File"+$CR+sFileName
				RET_M("")
			END IF	
			ff = FREEFILE
			OPEN sFileName FOR BINARY AS ff
			GET$ ff,LOF(ff),sBuffer
			CLOSE ff
			METHOD = sBuffer
		END METHOD
	END INTERFACE
END CLASS


FUNCTION PBMAIN()
	LOCAL oInBuffer AS iTextInBuffer
	LOCAL sBuffer AS STRING
	oInBuffer = CLASS "cTextInBuffer"
	oInBuffer.Filter = CHR$("BASIC", 0, "*.BAS;*.INC;*.BAK", 0)

	sBuffer = oInBuffer.Fill()
	? "Len of sBuffer = " + FORMAT$(LEN(sBuffer))
END FUNCTION
Boy was that one messed up. Here is I hope the correct one with the offending code left in but commented out so you could see the mistake

Code:
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
'SED_PBWIN
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*


#IF NOT %DEF(%Prop_MACROS)
    %Prop_MACROS = 1
    MACRO PropGet(PropName,PropType)=PROPERTY GET PropName() AS PropType:PROPERTY=PropName:END PROPERTY
    MACRO PropSet(PropName,PropType)=PROPERTY SET PropName(BYVAL param AS PropType):PropName=param:END PROPERTY
#ENDIF
'Return Nacros
#IF NOT %DEF(%RET_M_MACRO)
    %RET_M_MACRO = 1
    MACRO Ret_M(RetVal) = METHOD=RetVal:EXIT METHOD
#ENDIF
#IF NOT %DEF(%RET_F_MACRO)
    MACRO Ret_F(RetVal) = FUNCTION=RetVal:EXIT FUNCTION
    %RET_F_MACRO = 1
#ENDIF
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
CLASS cFileOpen
	INSTANCE FileName,Folder,Filter,Start,DflExt,Title AS STRING
	INSTANCE hParent,Flags AS DWORD
'******************************************************************************
'You should not do this if your class will be used as a base class as it is here
'because this CLASS METHOD WILL never be called. The CLASS METHOD OF The Top
'derived class's CLASS METHOD is called. In this particular instance it really does
'no harm but no good either.
'	CLASS METHOD CREATE
'		Filter = CHR$("All Files",0,"*.*",0)
'		Flags = %OFN_EXPLORER OR %OFN_FILEMUSTEXIST
'	END METHOD
'******************************************************************************	
	INTERFACE iFileOpen : INHERIT IUNKNOWN		
		PropSet(FileName,STRING)
		PropSet(Folder,STRING)
		PropSet(Filter,STRING)
		PropSet(hParent,DWORD)
		PropSet(DflExt,STRING)
		PropSet(Start,STRING)
		PropSet(Title,STRING)
		PropSet(Flags,DWORD)
		METHOD GetName() AS STRING
			DISPLAY  OPENFILE hParent,,,Title,Folder,Filter,Start,DflExt,Flags TO FileName
			METHOD = FileName			
		END METHOD
	END INTERFACE
END CLASS
'==============================================================================
CLASS cTextInBuffer
	INSTANCE sFileName,sBuffer AS STRING
	INTERFACE iTextInBuffer : INHERIT cFileOpen,iFileOpen
		METHOD Fill(OPT FName AS STRING) AS STRING
			LOCAL ff AS LONG
			IF ISMISSING(FName) THEN
				sFileName = MYBASE.GetName
			ELSE
				sFileName = FName	
			END IF
			IF ISFILE(sFileName) = 0 THEN
				? "Could not locate File"+$CR+sFileName
				RET_M("")
			END IF	
			ff = FREEFILE
			OPEN sFileName FOR BINARY AS ff
			GET$ ff,LOF(ff),sBuffer
			CLOSE ff
			METHOD = sBuffer
		END METHOD
	END INTERFACE
END CLASS


FUNCTION PBMAIN()
	LOCAL oInBuffer AS iTextInBuffer
	LOCAL sBuffer AS STRING
	oInBuffer = CLASS "cTextInBuffer"
	oInBuffer.Filter = CHR$("BASIC", 0, "*.BAS;*.INC;*.BAK", 0)
        oInBuffer.Flags = %OFN_EXPLORER OR %OFN_FILEMUSTEXIST
	sBuffer = oInBuffer.Fill()
	? "Len of sBuffer = " + FORMAT$(LEN(sBuffer))
END FUNCTION
Attached Files