DLL Example: Passing Structures

Structures are data storage objects that contain one or more fields (or elements). A structure can contain fields of different data types. For more information on structures, see Overview of Structures.

The example below calls the GetVersionEx function, which retrieves extended information about the version of the operating system that is currently running. In the module from which the sample code was drawn, GetVersionEx was exported from the Windows API's Kernel32.dll and inserted under the program module's Libraries submodule as shown below.

The sample code below, which uses a fixed size string, shows how to pass a structure.

 

verinfo.dwOSVersionInfoSize=sizeof verinfo

if not GetVersionEx(verinfo)

TestStatus=FAIL

endif

if verinfo.dwMajorVersion<3

TestStatus=FAIL

endif

s=verinfo.szCSDVersion

if len(verinfo)<1

TestStatus=FAIL

endif