I am playing with a prog which displays "mini images" - made from a file.jpg
When you click on the mini the originalsized jpg opens.
I made it out of various examples for bitblt and stretchblt.
Works fine.
Only problem is that I absolutely don't understand what the proc "UnicodeStr" is doing and
I hate not understanding part of my program.
Could someone give me information on this proc,please ?
.IF uMsg==WM_CREATE
mov eax,OFFSET StartupInfo
mov GdiplusStartupInput.GdiplusVersion[eax],1
INVOKE GdiplusStartup,ADDR token,ADDR StartupInfo,0
INVOKE UnicodeStr,ADDR image_name,ADDR UnicodeFileName ;ascii to unicode I suppose
INVOKE GdipCreateBitmapFromFile,ADDR UnicodeFileName,ADDR BmpImage
INVOKE GdipCreateHBITMAPFromBitmap,BmpImage,ADDR hBitmap,0
;BITMAP.bmWidth[edx] height and width of the selected picture
;BITMAP.bmHeight[edx]
.ELSEIF uMsg==WM_PAINT
INVOKE BeginPaint,hWnd,ADDR ps
mov hdc,eax
INVOKE CreateCompatibleDC,hdc
mov hMemDC,eax
INVOKE SelectObject,eax,hBitmap
INVOKE GetObject,hBitmap,sizeof(BITMAP),ADDR bm
lea edx,bm
mov eax,iCurrentMode
INVOKE SetStretchBltMode,hdc,eax
INVOKE StretchBlt,hdc,460,235,150,113,hMemDC,0,0,BITMAP.bmWidth[edx],BITMAP.bmHeight[edx],SRCCOPY
;150 x 113 is provisorial - works only with pictures in 4 x 3 relation 800x600 1024x68 3648x236
INVOKE DeleteDC,hMemDC
INVOKE EndPaint,hWnd,ADDR ps
;====================
;Changes the ascii image stringto a unicode string I suppose
UnicodeStr PROC USES esi ebx Source:DWORD,Dest:DWORD
mov ebx,1
mov esi,Source
mov edx,Dest
xor eax,eax
sub eax,ebx ; ?? eax is -1 in any case this moment
@@:
add eax,ebx ; I don't see that ebx has changed
movzx ecx,BYTE PTR [esi+eax] ;??
mov WORD PTR [edx+eax*2],cx ;??
test ecx,ecx
jnz @b
ret
UnicodeStr ENDP
;====================