NO

Author Topic: Bugs on your desktop  (Read 2770 times)

Offline Vortex

  • Member
  • *
  • Posts: 802
    • http://www.vortex.masmcode.com
Bugs on your desktop
« on: July 11, 2011, 10:29:14 PM »
Hello,

Here is a simple application displaying blue colored bugs on your desktop.

Code: [Select]

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
Code it... That's all...