Microsoft KB Archive/199165

= SAMPLE: SndArray.exe Sends/Receives Variant Arrays from/to MSMQ =

Article ID: 199165

Article Last Modified on 8/5/2004

-

APPLIES TO


 * Microsoft Message Queue Server 1.0

-



This article was previously published under Q199165



SUMMARY
The SndArray.exe sample demonstrates how to convert an array of variants to a byte array and send and receive it in an MSMQ message.



MORE INFORMATION
The following files are available for download from the Microsoft Download Center:

SndArray.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. The SndArray.exe sample demonstrates how to convert an array of variants to a byte array and send and receive it as an MSMQ message.

The Visual Basic sample uses two helper functions (GetVariantArrayFromBuffer and GetBufferFromVariantArray) implemented in a Win32 DLL created by a Visual C++ 5.0 project. Both Visual C++ and Visual Basic samples are included in the self-extracting file.

To send an array of variants as an MSMQ message, you need to manually serialize your array of variants to a byte array and unpack it at the receiver. The sample code does this generically for an array of Variants whose fields are numeric or strings. You can implement more complex types in a similar manner by modifying the source code of this sample. You can also use the Variant array support to simulate structures by sending over the field names.

Uncompress the SndArray.exe file and build the Visual C++ sample to create the DLL. Change the lib path appropriately for the following statements in the Visual Basic application:

Private Declare Function GetBufferFromVariantArray Lib "c:\temp\SendArray\debug\SendArray.dll" ( _   pvarIn As Variant, _    pcbBuf As Long, _    pvarOut As Variant) As Long Private Declare Function GetVariantArrayFromBuffer Lib "c:\temp\SendArray\debug\SendArray.dll" ( _   ByVal cbBuf As Long, _    pvarIn As Variant, _    pvarOut As Variant) As Long

Keywords: kbinfo kbdownload kbmsmq100 kbfile kbsample KB199165

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.