VB6 Types and VISA C Types Reference

Agilent VISA.NET

VB6 Types and VISA C Types Reference

VISA Type

VB6 Type

Description

ViInt8, ViUInt8, ViChar, ViByte

Byte

 

ViInt16, ViUInt16

Integer

Since VB6 does not support signed bytes, the byte type is used for both.

ViInt16, ViUInt16

Long

Since unsigned shorts are not supported in VB6, the signed type is used for both.

ViInt32, ViUInt32

Long

Since unsigned integers are not supported in VB6, the signed type is used for both.

ViSession, ViPFindList, ViPEvent

Long

Sessions and other VISA object handles are just 32-bit integers.

ViStatus

Long

Status codes (error codes) have always been 32-bit integers.

ViAddr

Long

This is a reference to a remote 32-bit memory space, and will therefore fit in a 32-bit integer

ViBuf

String

This type represents byte buffers or ASCII strings that are not to be modified by VISA.  The String type was chosen for methods that typically write ANSI strings.  When a string is passed 'byVal' to an external DLL (such as visa32.dll) VB6 automatically marshals the String type into a pointer to an ASCII string that VISA can accept. 

ViPBuf

String

This type represents byte buffers or ASCII string buffers that are to be written to by VISA.  The String type was chosen for functions that typically write ASCII strings, because the default marshaling behavior of that class is to give the C function a pointer to the beginning of the preallocated buffer, and to use the 0 ASCII value to determine the end of the string written in the buffer.  Don't forget to allocate enough storage space in your String or to declare the String as fixed length (.e.g. Dim myString as String * 256) before calling the VISA function.

ViChar[]

String

Arrays of ViChar are used when VISA plans to write short-length strings into the passed-in buffer.  Again, the String type is well-suited to acting as a character buffer.  Don't forget to allocate enough storage space in your String or to declare the String as fixed length (e.g. Dim myString as String * 256) before calling the VISA function.

ViAttrState

Byte, Integer Long

The value passed to viSetAttribute is an 8-, 16-, or 32-bit integer.

void *

Byte, Integer Long String

viSetAttribute can return 8-, 16-, or 32-bit integers, or strings.  Don't forget to allocate enough storage space in your String or to declare the string as fixed length (e.g. Dim myString as String * 256) before calling the VISA function.

ViPUInt8, ViPInt8, etc.

Byte, Integer, etc.

The ViPXXXX types where 'XXXXX' is an integral type are return values for integer types.  Functions that return pointers to integer types have these parameters declared using the 'ByRef' keyword so the address of the variable is passed rather than its value.

See Also

Using the VISA C API in Microsoft Visual Basic 6