Microsoft DirectX 8.1 (Visual Basic) |
Some methods, such as DirectInputDevice8.SendDeviceData, take a typed array as a parameter. For example, in the following code fragment, formatArray is an array of DIDEVICEOBJECTDATA types, lCount contains the number of elements in the array, and lFlags is a flag parameter that controls how the data is sent.
MyDevice.SendDeviceData(lCount, formatArray(), lFlags)
A few DirectX8 methods use parameters with an Any type to return data. An example is the DirectSoundCaptureBuffer8.ReadBuffer method's buffer parameter. Typically you will want such methods to return their data as an array of bytes. However, you cannot simply pass the name of the array to the method because Microsoft® Visual Basic® arrays contain extra information ahead of the actual data. Instead, you must pass the first element of the array. For example, in the following code fragment, dsCaptureBuffer is a DirectSoundCaptureBuffer8 object, nBytes is a Long value containing the number of bytes to be read, and buffer is a zero-based array of bytes:
ReDim buffer(nBytes) Call dsCaptureBuffer.ReadBuffer(0, nBytes, buffer(0), 0)