REM LoadDLL Version 1.10 05-Jun-2005
      REM (C) Jon Ripley, 2005
      REM This code may be used and modified freely
      REM 1.10 Updated based on suggestions by Richard Russell
      :
      REM FN_LoadDLL(dll$,call$)
      REM Loads specified DLL into memory
      REM Returns the handle of the specified function
      REM For subsequent requests for the same DLL you do not need to specify dll$
      DEF FN_LoadDLL(dll$,call$)
      PRIVATE dll%:LOCAL ret%
      IF dll$="" SYS "GetProcAddress", dll%, call$ TO ret%:=ret%
      SYS "GetModuleHandle", dll$ TO dll%
      IF dll%=0 SYS "LoadLibrary",dll$ TO dll%
      SYS "GetProcAddress", dll%, call$ TO ret%:=ret%
      :
      REM FN_FreeDLL(dll$)
      REM Tidy up after using a DLL to save system resources
      DEF PROC_FreeDLL(dll$)
      LOCAL dll%
      SYS "GetModuleHandle", dll$ TO dll%
      SYS "FreeLibrary",dll%
      ENDPROC