For fun,here is a small program displaying a lot of blue colored bugs on your desktop.
You can make a joke to your friends,even it's possible to add some "timer" code to make
the sense that "suddenly" the desktop is invaded by small bugs! (The bug icon doesn't belong
to me. :) )




format PE GUI 4.0
entry start

include 'include\kernel.inc'
include 'include\user.inc'

include 'include\macro\stdcall.inc'
include 'include\macro\import.inc'
include 'include\macro\resource.inc'

section '.data' data readable writeable

x dd ?
y dd ?
hDesktop dd ?
hIcon dd ?
hModule dd ?
xp dd ?
yp dd ?
time rb 16

section '.code' code readable executable

start:

invoke GetModuleHandle,0
mov [hModule],eax
invoke GetSystemMetrics,SM_CXSCREEN
mov [x],eax
invoke GetSystemMetrics,SM_CYSCREEN
mov [y],eax
invoke GetDC,0
mov [hDesktop],eax
invoke LoadIcon,[hModule],100
mov [hIcon],eax
invoke GetSystemTime,time
mov eax,time
add eax,14
mov ecx,dword [eax]
start2:
push ecx
invoke rand
pop ecx
loop start2
mov ecx,1500
displaybug:
push ecx
invoke rand
xor edx,edx
div [x]
mov [xp],edx
call [rand]
xor edx,edx
div [y]
mov [yp],edx
invoke DrawIcon,[hDesktop],[xp],[yp],[hIcon]
mov ecx,1250000
delay:
xor eax,eax
loop delay
pop ecx
loop displaybug
invoke ReleaseDC,0,[hDesktop]
invoke ExitProcess,0

section '.idata' import data readable writeable

library kernel,'KERNEL32.DLL',\
user,'USER32.DLL',\
crtdll,'CRTDLL.DLL'
kernel:
import ExitProcess,'ExitProcess',\
GetModuleHandle,'GetModuleHandleA',\
GetSystemTime,'GetSystemTime'
user:
import GetSystemMetrics,'GetSystemMetrics',\
LoadIcon,'LoadIconA',\
DrawIcon,'DrawIcon',\
GetDC,'GetDC',\
ReleaseDC,'ReleaseDC'

crtdll:
import rand,'rand'

section '.rsrc' resource data readable

directory RT_ICON,bugicon,\
RT_GROUP_ICON,group_icons

bugicon:
resource 1,LANG_NEUTRAL,icon_data

group_icons:
resource 100,LANG_NEUTRAL,main_icon

icon main_icon,icon_data,'bug.ico'

Posted on 2002-12-11 14:13:52 by Vortex
Funny app. :)
(one could almost think the app showed the bugs it found in windows desktop drawing proc...) ;)
Posted on 2002-12-11 15:08:14 by scientica
Even works under Linux :)
Posted on 2002-12-11 15:22:07 by bazik
I changed the icon and recompiled it with FASMW (running on Linux via Wine) :)
(I think it looks a bit blurry because the Icon is only 16x16... but hey, at least its transparent :grin: )
Posted on 2002-12-11 15:37:17 by bazik
Very good program for testing quality of the RN generators.
Was tested shift random number generator (is added).
Thanks, Vortex!:)
Posted on 2002-12-12 03:07:44 by tserk
Bazik,nice idea of penguins. How can I make transparent my bug icon?

Tserk,you are welcome. I will study your random number generator.

Regards,

Vortex
Posted on 2002-12-12 03:49:06 by Vortex

Bazik,nice idea of penguins. How can I make transparent my bug icon?


Get a decent Icon editor and set the white color to transparent (for Windows you can use Microangelo - www.impact-soft.com)
Posted on 2002-12-12 04:14:46 by bazik
If you want an _accurate_ timing loop you can use Sleep instead of your manual loop... but that is maybe overkill, I agree, but in very fast processors it can probably draw things very fast...
Posted on 2002-12-12 04:18:41 by JCP
Yes,Bazik thanks! I should think of using an icon editor. Location Mars Polar Zone? Stryker will be happy to
see a friend there :)

Regards,

Vortex
Posted on 2002-12-12 04:20:26 by Vortex