| Dettagli del download |
|
AccessDLLFromScript is a project designed to show how to call functions exported by DLL (dynamic-link library) from a script. The VBScript language, which is used for writing scripts in Reliance projects, does not itself support calling DLL functions. This limitation can be worked around by using a utility called DynaCall, which can, at runtime, create an object-like wrapper around any DLL so that its functions could be called even from VBScript code. DynaCall utility installation instructions: 1. Unpack the ZIP archive named DynaCall.zip (located in AccessDLLFromScriptMainApps) to any directory, e.g., c:Program Files (the following directory will be created: c:Program FilesDynaCall). 2. From the command prompt (cmd.exe), register the file c:Program FilesDynaCalldynwrap.dll by the following command: regsvr32.exe "c:Program FilesDynaCalldynwrap.dll". Note: If the above command ends with an error, it is necessary to use the following steps: 3. Create a shortcut to cmd.exe. 4. From the context menu of the shortcut, choose the Run as Administrator command and confirm launching the program. 5. Repeat step 2. The project contains a script named Example1_user32.dll_MessageBox, which makes it clear how to call DLL functions from scripts. The script demonstrates calling the MessageBoxA function from user32.dll (one of the fundamental DLLs of Windows) and can be run by clicking a button located in the main window of the project. In the script, the below steps are used: 1. Create the DLLWrapper object by the following statement: Set DLLWrapper = CreateObject("DynamicWrapper"). 2. Register the respective function by calling the Register method. 3. Call the function as a method of the DLLWrapper object, e.g., Result = DLLWrapper.MessageBoxA. The steps taken to register the MessageBoxA function must be repeated for all other functions that are to be called. Important: 1. The object variable DLLWrapper must be declared as local (inside a procedure) in the same way as in the example. If it were declared as global and the DLLWrapper object were not freed (by using Set DLLWrapper = Nothing) before ending the project, the runtime software would hang during ending the program. 2. The DynaCall utility is free of charge and its authors deny any responsibility for damage caused by possible malfunctions of the utility. |
|
|||||||||||||||||||||||||||||||||

Gli esempi presenti su questo sito sono stati liberamente inviati dagli utenti di automationforum.it, è stato espressamente specificato loro di inviare solo esempi FREE. Automationforum.it non si ritiene responsabile dell'eventuale presenza di esempi rilasciati sotto licenza commerciale, Automationforum.it invita tutti coloro che individuano esempi rilasciati sotto licenza commerciale presenti in questa raccolta a segnalarlo dall'apposito