BugIcon.bas:
Code: Select all
#include once "windows.bi"
#include once "crt.bi"
Function WinMain Stdcall Alias "WinMain" () As Any Ptr
Dim As HICON hIcon
Dim As Integer _width,height
Dim As HDC hDesktop
Dim As SYSTEMTIME st
Dim As Uinteger i
hIcon=LoadIcon(GetModuleHandle(0),MAKEINTRESOURCE(100))
_width=GetSystemMetrics(SM_CXSCREEN)
height=GetSystemMetrics(SM_CYSCREEN)
hDesktop=GetDC(0)
GetSystemTime(@st)
For i=0 To st.wMilliseconds
rand()
Next i
For i=0 To 500
DrawIcon(hDesktop,rand() Mod _width,rand() Mod height,hIcon)
_sleep(10)
Next i
ReleaseDC(0,hDesktop)
End Function
Function WinMainCRTStartup Naked Cdecl Alias "WinMainCRTStartup"() As Any Ptr
WinMain()
ExitProcess 0
End Function
Code: Select all
100 ICON "Icon.ico"
Code: Select all
IF NOT EXIST Icon.ico ( Call Icon.bat )
\FreeBASIC\fbc -nodeflibs -c BugIcon.bas Rsrc.rc
IF EXIST \MinGW\bin\objcopy.exe ( \MinGW\bin\objcopy --remove-section .fbctinf --remove-section .ctors BugIcon.o )
\FreeBASIC\bin\win32\ld -e _WinMainCRTStartup -subsystem windows -o BugIcon.exe BugIcon.o Rsrc.obj -L\FreeBASIC\lib\win32 -lkernel32 -luser32 -lgdi32 -lmsvcrt -s
Code: Select all
Set f=Icon.cab.b64
echo TVNDRgAAAACGAQAAAAAAACwAAAAAAAAAAwEBAAEAAAAAAAAARQAAAAEAAQD+AgAA > %f%
echo AAAAAAAAXVCArCAASWNvbi5pY28Aph0rijkB/gJDS8VRsXEEIQxcezyEyJHTd+gy >> %f%
echo XApOPsQtfGlfChHjCBRdiLwS9+MSLNAJaTlpkYAnrsv7K1x+noE32g/qhfoJx18C >> %f%
echo uxErtF/Uffsht9i43bbxxcP9fqf1iMWG2Ta+POR+CIMSB41w5BRTiGrYEI9rKjS9 >> %f%
echo I/VG4IrUTHOtpdYKU8b9O3tzNU3QLrmuVahVUlM9JM0xG7VLUnV8jVHqGBtfBSfe >> %f%
echo UFVNejnxcp2irKYPfLGWs3vg56N0LuJUc+aiYAHWH9EDafmQjaeFCZX2h9P1jNlm >> %f%
echo GzaF3VHvSZ7kPxeiP2YJo4GaZPsCZlhM7b561/BtvYifFSbkQZxESR9J8tlQRiUh >> %f%
echo 84UGzSTCmwva+BeZ5YPF3fH+X63NwxsvGkM68ZMP4+TTZPtqf/MKT2LY4g+Tje6Z >> %f%
echo x0Hxz/IL >> %f%
CertUtil -decode %f% Icon.cab
Expand -r Icon.cab
https://www.microsoft.com/en-us/downloa ... x?id=16770
certutil is necessary to decode the BASE64 file containing the compressed icon.