Passing Arguments to DLL Functions

DLL functions are written in C, so the arguments that you pass to these functions must have the appropriate C data types. The following data types are supported:
Integer
Use this data type for arguments or return values with the following data types:
  • int
  • INT
  • long
  • LONG
  • DWORD
  • BOOL
  • WPARAM
  • HWND
The Visual Basic type Integer works for all DLL arguments that have a 4-byte value.
Long
Use this data type for arguments or return values with the C data types long and int64. The Visual Basic type Long works for all DLL arguments that have an 8-byte value.
Short
Use this data type for arguments or return values with the C data types short and WORD. The Visual Basic type Short works for all DLL arguments that have a 2-byte value.
Boolean
Use this data type for arguments or return values with the C data type bool.
String
Use this for arguments or return values that are Strings in C.
Double
Use this for arguments or return values with the C data type double.
Single
Use this for arguments or return values with the C data type float.
SilkTest.Ntf.Rectangle
Use this for arguments with the C data type RECT. Rectangle cannot be used as a return value.
SilkTest.Ntf.Point
Use this for arguments with the C data type POINT. Point cannot be used as a return value.
SilkTest.Ntf.TestObject
Use this for arguments with the C data type HWND. TestObject cannot be used as a return value, however you can declare DLL functions that return a HWND with an Integer as the return type.
Note: The passed TestObject must implement the SilkTest.Ntf.INativeWindow interface so that Silk Test Workbench is able to determine the window handle for the TestObject that should be passed into the DLL function. Otherwise an exception is thrown when calling the DLL function.
List
Use this for arrays for user defined C structs. Lists cannot be used as a return value.
Note: When you use a List as an output parameter, by using ByRef, the list that is passed in must be large enough to hold the returned contents.
Note: A C struct can be represented by a List, where every list element corresponds to a struct member. The first struct member is represented by the first element in the list, the second struct members is represented by the second element in the list, and so on.
Note: Any argument that you pass to a DLL function must have one of the preceding Visual Basic data types.