The information in this article applies to:
SUMMARY
Visual Basic for Windows does not support the MKx$ and CVx family of
conversion functions found in earlier versions of Microsoft QuickBasic
and Basic Professional Development System (PDS) for MS-DOS. However,
you can write functions that provide this support using the hmemcpy
API routine provided by Windows version 3.1. MORE INFORMATIONThe MKx$ functions convert numeric values to strings by placing the ASCII value of each byte that represents the numeric value into a string.
The CVx functions convert strings created with the MKx$ functions back
into numeric values.
The hmemcpy API function can be used to emulate these functions as
demonstrated in the example below. Note that the hmemcpy API function
is not provided with Windows version 3.0, so the example below requires
Windows version 3.1.The hmemcpy routine copies bytes from a source buffer to a destination buffer. You can use this routine to copy the value of each byte in a numeric value to a corresponding byte in a string to emulate the MKx$ functions. Similarly, you can use the same technique to copy the bytes from a string to a numeric value, to emulate the CVx functions. NOTE: The hmemcpy routine requires the addresses pointing to the actual location of the data to be copied from and written to. Therefore, it is necessary to pass strings by value (ByVal) in order to pass the location of the string data, as opposed to passing the location of the string descriptor. Similarly, it is necessary to initialize the string size by assigning the string to an appropriate number of characters. To use the following routines in your Visual Basic for Windows application, you must Declare the hmemcpy routine. Add the following code to the general declarations section of the form:
REFERENCES"Microsoft Windows SDK: Programmer's Reference," Volume 2: Functions," version 3.1 Additional query words: 2.00 3.00
Keywords : |
Last Reviewed: September 3, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |