Hello,
Here is a simple application displaying blue colored bugs on your desktop.
include Bug.inc
.data
Icon:
INCBIN bug.ico
.data?
_width dd ?
height dd ?
hDesktop dd ?
hIcon dd ?
.code
start:
invoke GetSystemMetrics,SM_CXSCREEN
mov _width,eax
invoke GetSystemMetrics,SM_CYSCREEN
mov height,eax
mov edx,OFFSET Icon
mov eax,ICONDIR.idEntries.dwImageOffset[edx]
add eax,edx
invoke CreateIconFromResource,eax,ICONDIR.idEntries.dwBytesInRes[edx],\
TRUE,030000h
mov hIcon,eax
invoke GetDC,0
mov hDesktop,eax
call main
invoke ReleaseDC,0,hDesktop
invoke ExitProcess,0
main PROC USES ebx esi
LOCAL _st:SYSTEMTIME
lea esi,_st
invoke GetSystemTime,esi
movzx ebx,SYSTEMTIME.wMilliseconds[esi]
@@:
invoke rand
sub ebx,1
jnz @b
mov ebx,500
@@:
invoke rand
xor edx,edx
div _width
mov esi,edx
invoke rand
xor edx,edx
div height
invoke DrawIcon,hDesktop,esi,edx,hIcon
invoke Sleep,1
sub ebx,1
jnz @b
ret
main ENDP
END start