Visual Basic Helper Routines
CopyMemory: Handy Macros to Convert Between Signed and Unsigned Integers
Posted:   Monday March 03, 2003
Updated:   Monday December 26, 2011
Applies to:   VB4-32, VB5, VB6
Developed with:   VB6, Windows XP6
OS restrictions:   None
Author:   Various contributors, VBnet - Randy Birch
32-bit VB.

Add the following functions to a form or BAS module, and declare as appropriate:

Option Explicit
' Copyright 1996-2011 VBnet/Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce 
'               or publish this code on any web site,
'               online service, or distribute as source 
'               on any media without express permission.
Private Declare Sub CopyMemory Lib "kernel32" _
   Alias "RtlMoveMemory" _
  (Destination As Any, _
   Source As Any, _
   ByVal Length As Long)
Public Function SWordToUWord(ByVal inWord As Integer) As Long 'Mike Sutton CopyMemory ByVal VarPtr(SWordToUWord), ByVal VarPtr(inWord), 2 End Function


PayPal Link
Make payments with PayPal - it's fast, free and secure!


Copyright 1996-2011 VBnet and Randy Birch. All Rights Reserved.
Terms of Use  |  Your Privacy


Hit Counter