You are currently offline, waiting for your internet to reconnect

SAMPLE: ARRAYCONVERT.EXE Variant Conversion Functions

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:
The ArrayConvert.exe file contains the following files:

ADS.vbp747 bytes
ADS.vbw35 bytes
ArrayConvert.cls3017 bytes
ArrayConvertTest.bas1205 bytes
ArrayConvertTest.vbg67 bytes
ArrayConvertTest.vbp884 bytes
ArrayConvertTest.vbw31 bytes
ADS.dll24,576 bytes
ADs.exp996 bytes
ADs.lib2536 bytes
AdsConvert.vbg73 bytes


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.
  2. 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.
  3. 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.
  4. 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.
  5. 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( _    "<LDAP://Server/o=organization/ou=site/cn=recipients>;(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.movenextWend				
ArrayConvert Array Convert
Properties

Article ID: 250344 - Last Review: 08/05/2004 17:14:32 - Revision: 4.2

  • 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 Enterprise Edition for Windows 6.0
  • kbdownload kbfile kbhowto kbprogramming kbsample KB250344
Feedback