Microsoft KB Archive/250344

= SAMPLE: ARRAYCONVERT.EXE Variant Conversion Functions =

Article ID: 250344

Article Last Modified on 8/5/2004

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 4.0 Enterprise Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q250344



SUMMARY
ArrayConvert.exe is a sample that is used to convert Variants of one type to Variants of another type. For example, if you are using Visual Basic Script (VBScript), these conversion functions aid you in converting a Variant that contains an Octet string to a Variant that contains a Hex string.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

ArrayConvert.exe

The ArrayConvert.exe file contains the following files:

Release Date: Apr-13-2000

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 five functions that are in this sample are:
 * 1) CStrArray - Use this function to convert a Variant Array of strings to a Variant Array of Variants containing strings. This allows VBScript to access multi-valued string attributes returned in ADO recordsets.

CvOctetStr2vHexStr - Use this function to convert a Variant Array of bytes to a Variant containing an ASCII-encoded Hex string. This allows VBScript to translate an ADSTYPE_OCTETSTRING Variant into a string of ASCII characters 0-9 A-F.

CvHexStr2vOctetStr -Use this function to convert a Variant containing an ASCII-encoded Hex string to a Variant Array of bytes. This allows VBScript to create Variants for ADSTYPE_OCTETSTRING from strings of ASCII characters 0-9 A-F.

CvOctetStr2vStr - Use this function to convert a Variant Array of bytes to a Variant containing an ASCII string. This allows VBScript to translate an ADSTYPE_OCTETSTRING Variant into a string of ASCII characters.

CvStr2vOctetStr - Use this function to convert a Variant containing a string to a Variant Array of bytes. This allows VBScript to create Variants for ADSTYPE_OCTETSTRING from strings of ASCII characters.
 * 1) CvOctetStr2vHexStr - Use this function to convert a Variant Array of bytes to a Variant containing an ASCII-encoded Hex string. This allows VBScript to translate an ADSTYPE_OCTETSTRING Variant into a string of ASCII characters 0-9 A-F.

CvHexStr2vOctetStr -Use this function to convert a Variant containing an ASCII-encoded Hex string to a Variant Array of bytes. This allows VBScript to create Variants for ADSTYPE_OCTETSTRING from strings of ASCII characters 0-9 A-F.

CvOctetStr2vStr - Use this function to convert a Variant Array of bytes to a Variant containing an ASCII string. This allows VBScript to translate an ADSTYPE_OCTETSTRING Variant into a string of ASCII characters.

CvStr2vOctetStr - Use this function to convert a Variant containing a string to a Variant Array of bytes. This allows VBScript to create Variants for ADSTYPE_OCTETSTRING from strings of ASCII characters.
 * 1) CvHexStr2vOctetStr -Use this function to convert a Variant containing an ASCII-encoded Hex string to a Variant Array of bytes. This allows VBScript to create Variants for ADSTYPE_OCTETSTRING from strings of ASCII characters 0-9 A-F.

CvOctetStr2vStr - Use this function to convert a Variant Array of bytes to a Variant containing an ASCII string. This allows VBScript to translate an ADSTYPE_OCTETSTRING Variant into a string of ASCII characters.

CvStr2vOctetStr - Use this function to convert a Variant containing a string to a Variant Array of bytes. This allows VBScript to create Variants for ADSTYPE_OCTETSTRING from strings of ASCII characters.
 * 1) CvOctetStr2vStr - Use this function to convert a Variant Array of bytes to a Variant containing an ASCII string. This allows VBScript to translate an ADSTYPE_OCTETSTRING Variant into a string of ASCII characters.

CvStr2vOctetStr - Use this function to convert a Variant containing a string to a Variant Array of bytes. This allows VBScript to create Variants for ADSTYPE_OCTETSTRING from strings of ASCII characters.
 * 1) CvStr2vOctetStr - Use this function to convert a Variant containing a string to a Variant Array of bytes. This allows VBScript to create Variants for ADSTYPE_OCTETSTRING from strings of ASCII characters.

To use the sample, double-click on the self-extracting executable file ArrayConvert.exe. Using Visual Basic, open the ArrayConvertTest.vbg file. Once the project is open you can run the test program that demonstrates how to use the conversion functions.

To use the functions from VBScript, you can register the the Ads.Dll file by doing Regsvr32 Ads.dll and then calling the functions from VBScript.

The following is an example of using the CStrArray function in a VBScript to convert and display the members of Distribution lists in an Exchange Organization: Set cnvt = CreateObject("ADs.ArrayConvert") Set conn = CreateObject("ADODB.connection") conn.provider = "ADSDSOObject" conn.open "" Set rs = conn.execute( _   ";(objectClass=groupOfNames);ADsPath,member;onelevel") While Not rs.EOF v1 = cnvt.CStrArray(rs.fields("member").Value) For Each v2 In v1   msgbox v2    Next

rs.movenext Wend

Additional query words: ArrayConvert Array Convert

Keywords: kbhowto kbdownload kbprogramming kbfile kbsample KB250344

-

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

© Microsoft Corporation. All rights reserved.