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

ID: Q199165


The information in this article applies to:
  • Microsoft Message Queue Server version 1.0


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. Click the file names below to download the files:

SndArray.exe
For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address
http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center. 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 


Additional query words:

Keywords : kbfile kbsample kbMSMQ100 kbDSupport
Version : winnt:1.0
Platform : winnt
Issue type : kbinfo


Last Reviewed: December 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.