How to emulate MKI$ and CVI in Visual Basic 5 and Windows95 
Author Message
 How to emulate MKI$ and CVI in Visual Basic 5 and Windows95

Nino-
        How about these? If you need the MBF
flavors also, let me know.
                                Joe LeVasseur
___________snip_________________________

Option Explicit
' Old Basic routines, unsupported in VB4/5
' uses RtlMoveMemory to replace hMemCpy-
' since hMemCpy is not exported in Win32.
' Adapted from article in KB

'////////////////////////////////////////////////
Declare Sub hMemCpy Lib "KERNEL32" Alias "RtlMoveMemory" _
   (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)

Function MKI(x As Integer) As String
   Dim szTemp     As String
   szTemp = Space$(2)
   hMemCpy ByVal szTemp, x, 2
   MKI = szTemp
End Function

Function CVI(x As String) As Integer
   Dim iTemp     As Integer
   If Len(x) <> 2 Then
      MsgBox "Illegal Function Call"
      Exit Function
   End If
   hMemCpy iTemp, ByVal x, 2
   CVI = iTemp
End Function

Function MKL(x As Long) As String
   Dim szTemp     As String
   szTemp = Space$(4)
   hMemCpy ByVal szTemp, x, 4
   MKL = szTemp
End Function

Function CVL(x As String) As Long
   Dim lTemp      As Long
   If Len(x) <> 4 Then
      MsgBox "Illegal Function Call"
      Exit Function
   End If
   hMemCpy lTemp, ByVal x, 4
   CVL = lTemp
End Function

Function MKS(x As Single) As String
   Dim szTemp     As String
   szTemp = Space$(4)
   hMemCpy ByVal szTemp, x, 4
   MKS = szTemp
End Function

Function CVS(x As String) As Single
   Dim sTemp      As Single
   If Len(x) <> 4 Then
      MsgBox "Illegal Function Call"
      Exit Function
   End If
   hMemCpy sTemp, ByVal x, 4
   CVS = sTemp
End Function

Function MKD(x As Double) As String
   Dim szTemp      As String
   szTemp = Space$(8)
   hMemCpy ByVal szTemp, x, 8
   MKD = szTemp
End Function

Function CVD(x As String) As Double
   Dim dTemp      As Double
   If Len(x) <> 8 Then
      MsgBox "Illegal Function Call"
      Exit Function
   End If
   hMemCpy dTemp, ByVal x, 8
   CVD = dTemp
End Function

________snip_____________________________
--
***********************************************************

Microsoft Dev MVP- Visual Basic
"To none will we sell, to none deny or delay,
right or justice." Magna Carta  (June 15, 1215)
**********************************************************
PS- Please reply to the newsgroup- except in the
case of flames, insults, etc. (Don't bother.)



Quote:
> Visual Basic does not support the MKx$ and CVx family of conversion
> functions.
> I found Article Q87970 in Microsoft Knoeledge Base which solves the
> problem using Windows HMemCpy API routine but it doesn't work with VB5
> and Windows95.
> Is there someone able to help me?
> Thanks,
> Nino



Wed, 08 Mar 2000 03:00:00 GMT  
 How to emulate MKI$ and CVI in Visual Basic 5 and Windows95

Visual Basic does not support the MKx$ and CVx family of conversion
functions.
I found Article Q87970 in Microsoft Knoeledge Base which solves the
problem using Windows HMemCpy API routine but it doesn't work with VB5
and Windows95.
Is there someone able to help me?
Thanks,
Nino



Thu, 09 Mar 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. cvi/mki

2. VB5 Question: CVL/CVI/MKL/MKI

3. MKI$ CVI MKS$ CVS Help!

4. How to emulate MKI$ in VB4.0

5. Visual Basic for Japanese Windows95 ?

6. Please Help: Visual Basic stopped working in Chinese Windows95

7. CVI & MKI$ Removed??

8. Access97, VBA, Win32, API, Windows95: CreateEvent returns 0 with Windows95

9. do Visual Basic 6.0 and Visual Basic .NET version beta Working Both

10. Difference between Visual Basic 6 and Visual Basic.Net

11. Visual basic 4 to Visual basic 6

12. Visual Basic 3.0 to Visual Basic 6.0

 

 
Powered by phpBB® Forum Software