;
 ; ------------------------------------------------------
 ;        iChr = AscW(Mid$(sStr, lPos, 1))
 ;        iChr = MidIp(lspStr, lPos)
 ; ------------------------------------------------------
 ;
 ; Property Get MidIp(ByVal lspStr As Long, ByVal lPos As Long) As Integer
 ;    CopyMemory MidIp, ByVal lspStr + lPos + lPos - 2&, 2&
 ; End Property
 ;
 ; The position to read from is assumed to be within
 ; the allocated length of the specified string.
 ;
 ; ------------------------------------------------------
;
 .486           ; 32-bit instruction set
 .model flat    ; Protected memory, 4GB limit
 .code          ; Start of code

Get_MidIp proc near

   xor eax, eax       ; zero default return
   mov ecx,[esp+8]    ; copy string pointer
   mov edx,[esp+12]   ; copy pos parameter

   test ecx,ecx       ; validate string pointer
   jz _exitp          ; exit null string passed
   shl edx, 1         ; convert to byte position
   jbe _exitp         ; invalid read pos (jcz)
 
   mov ax,[ecx+edx-2] ; extract wchar into ax

  _exitp:
   mov ecx,[esp+16]   ; get return address
   mov [ecx], ax      ; assign the result

   xor eax, eax    ; clear eax tell VB all okay
   ret 16          ; cleanup (lpObj, p1, p2, rc)

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