How to invoke external DLL’s | Vbscript

Testmate provides you the capability to invoke procedures in external DLL’s.

The below code demonstrates the usage of  LoadAndRun method to invoke SetForegroundWindow  method from user32.dl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'Declare The DLL to be used
sDLL = "user32.dll"
 
'Declare the reulrn type - Which is boolean
sRet = "bool"
 
'Declare the method string
sDec = "static extern bool SetForegroundWindow(IntPtr hWnd)"
 
'Fetch the handle of the application
hwndCalculator = Native.GetHandleByCaption("Calculator")
 
'Declare the Method string
sFunc = "SetForegroundWindow((IntPtr)" & hwndCalculator & " )"
 
'Run the method from the DLL
Call dll.LoadAndRun(sDLL,sRet,sDec,sFunc)

Add a Comment

Your email address will not be published. Required fields are marked *