Questo sito utilizza i cookie per migliorare servizi ed esperienza degli utenti. Se decidi di continuare la navigazione consideriamo che accetti il loro uso.

Panoramica Cerca Sopra
Dettagli del download
Accessing a DLL from a sc Accessing a DLL from a script
(0 voti)

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.

Informazioni

Versione:
Dimensione69.77 KB
Downloads0
Lingua
Licenza
Autore
Sito Web
Prezzo
Creato24-08-2015
Creato da
Modificato il24-08-2015
Modificato daroby

Solo gli utenti registrati e loggati possono scaricare questo file.

.

.