LoadDll
LoadDll Filename$, DLLNumber
 
Parameters:

    Filename$ = The file name and path of the DLL you wish to load
    DLLNumber = The DLL number where you wish to store the DLL
Returns: NONE
 

      LoadDll will read a DLL from disk into your computer's memory for later use. You must provide this command with the path and filename of the DLL to load, and a free DLL index.



FACTS


      * You can only use standard DLLs. See: NewAX for ActiveX support.

      * Use GetDllExist to check if DLL has already been loaded

      * Use GetDllCallExist to check if a function exists within a loaded DLL

      * Use DllCallConv to change the calling convention used to call functions from a DLL.




Mini Tutorial:


      This example shows how to toggle the visibility of the mouse cursor using Windows' user32.dll.

  
  Filename$="User32.dll"
  
; Check if the DLL file has been loaded ?
  If GetDllExist(Filename$) =0
     
     Print "Loading DLL"
     
   ; Ask PlayBASIC for a currently Free DLL index.
     User32 = GetFreeDll()
     
   ; Load the USer32 dll into memory ready for use
     LoadDll "user32.dll", User32
     
     
  EndIf
  
  
; Check if function "ShowCursor" exists in this DLL
  If GetDllCallExist(user32,"ShowCursor"= 1
     Print "Calling Function 'ShowCursor' from this dll"
     Print ""
     
   ; "ShowCursor" only expects one parameter:
   ; passing 1 will show the mouse, 0 will hide it
     Print "Hiding Mouse POinter"
   ; Hide the mouse cursor
     CallDll(user32,"ShowCursor",0)
     
     Print "Press any key to show the mouse pointer again"
     Sync
     WaitKey : WaitNoKey
   ; Show the mouse cursor
     CallDll(user32,"ShowCursor",1)
     Print "The mouse is back."
     Print ""
     
  Else
     Print "SOrry this function doesn't exist in this dll"
  EndIf
  
  Sync
  WaitKey
  
; Delete the DLL from memory
  DeleteDll user32
  


 
Related Info: CallDll | DeleteDll | GetDLLCallExist | GetDllExist | GetDllFileName$ | GetDllStatus | GetFreeDll | LinkDLL | LoadNewDll | NewAx :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com