FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

DISK I/O

Use FileToHandle & ResToHandle


LOCAL FN fileToHandle(fName$,vRef%)
  OPEN "I",#1,fName$,1,vRef%
  sz& = LOF(1)
  hndl& = FN NEWHANDLE _clear(sz&)
  LONG IF hndl&
    READ FILE #1,[hndl&],sz&
  END IF
  CLOSE #1
END FN = hndl&

LOCAL FN resToHandle(rName$,rType&)
  rHndl& = FN GETNAMEDRESOURCE(rType&,rName$)
  LONG IF rHndl&
    hState = FN HGETSTATE(rHndl&)
    err = FN HNOPURGE(rHndl&)
    rHndl& = FN HANDTOHAND(rHndl&)
    err = FN HSETSTATE(rHndl&,hState)
  END IF
END FN = rHndl&

STAZ ~)~