In a hooked/subclassed MessageBox:
' ===============================
' 99 Bottles of Beer GUI Version
' ©2011 Mike LOBKO-LOBANOVSKY
' ===============================
#Option Strict
#EscapeChars On
#Include <Include/Windows.inc>
#Define Bottles :
#Define Alcohol Integer
#Define Some_Beer_Left Beer
' ============= LOL ============
Dim Beer As Alcohol = 99 Bottles
' ==============================
SetWindowsHookEx(WH_CBT, AddressOf CBTProc, NULL, GetCurrentThreadId())
MsgBox(NULL, LPad("\n", 128) & LPad, "99 Bottles of Beer in a Fancy FBSL v3 Message Box GUI :)", MB_OK BOr MB_ICONINFORMATION)
UnhookWindowsHookEx(SetWindowsHookEx)
Function CBTProc(ByVal %ncode, ByVal %wparam, ByVal %lparam) As Integer
If ncode >= 0 Then
If ncode = HCBT_ACTIVATE Then
SetWindowLong(wparam, GWL_WNDPROC, AddressOf MsgBoxProc)
SetTimer(wparam, 1000, 100, NULL)
Return 0
End If
End If
Return CallNextHookEx(SetWindowsHookEx, ncode, wparam, lparam)
End Function
Function MsgBoxProc(ByVal %hwnd, ByVal %msg, ByVal wparam, ByVal lparam) As Integer
Static buffer As String * 256
Select Case msg
Case WM_TIMER
If wparam = SetTimer Then
If Some_Beer_Left Then
SPrintF(buffer, "%d bottle%s of beer on the wall, %d bottle%s of beer...\nTake one down and pass it around -- %d bottle%s of beer!", _
%Beer, $IIf(Beer = 1, "", "s"), %Beer, $IIf, %Decr(Beer), $IIf(Beer = 1, "", "s"))
Else
SPrintF(buffer, "No more bottles of beer on the wall, no more bottles of beer...\nGo to the store and buy some more ninety nine bottles of beer!")
End If
FbslSetText(GetDlgItem(hwnd, &HFFFF), Left(buffer, SPrintF))
Return 0
End If
Case WM_CLOSE
KillTimer(hwnd, SetTimer)
SetWindowLong(hwnd, GWL_WNDPROC, SetWindowLong)
End Select
Return CallWindowProc(SetWindowLong, hwnd, msg, wparam, lparam)
End Function
The zip below contains a precompiled executable.