;
 ; ------------------------------------------------------
 ;        RightI(sStr, lPosR) = iChr
 ; ------------------------------------------------------
 ;
 ; Property Let RightI(sStr As String, ByVal lPosR As Long, ByVal iChr As Integer)
 ;    CopyMemory ByVal StrPtr(sStr) + LenB(sStr) - lPosR - lPosR, iChr, 2&
 ; End Property
 ;
 ; ------------------------------------------------------
;
 .486           ; 32-bit instruction set
 .model flat    ; Protected memory, 4GB limit
 .code          ; Start of code

Let_RightI proc near

   push esi          ; preserve ptr register
   mov esi,[esp+12]  ; copy string descriptor
   mov edx,[esp+16]  ; copy insert pos param
   mov esi,[esi]     ; extract string pointer

   shl edx, 1        ; convert to byte position
   jbe _exitp        ; invalid pos param (jcz)
   test esi,esi      ; validate string pointer
   jz _exitp         ; exit null string passed

   mov ecx,[esi-4]   ; extract byte len of str
   mov ax, [esp+20]  ; extract specified wchar
   sub ecx, edx      ; calc offset from str start
   js _exitp         ; exit outside string bounds

   mov [esi+ecx],ax  ; insert char into position

  _exitp:
   pop esi       ; restore pointer register
   xor eax, eax  ; clear eax tell VB all okay
   ret 16        ; cleanup (lpObj, p1, p2, p3)

Let_RightI endp  ; end of procedure
end Let_RightI   ; end of code, indicate entry point
