$ filename "Lyrics.exe"
'uses rtl32
'uses rtl64
uses WinUtil
'uses console
% DS_MODALFRAME=128
% GCLP_HBRBACKGROUND= -10
% COLOR_3DFACE=15
extern lib "winmm.dll"
! mciSendString "mciSendStringA" '4
end extern
declare sub loadlyrics()
redim string lyrics[30]
sys lbl[5]
loadlyrics()
sys hInstance=inst
MainWindow 400,220, DS_MODALFRAME OR WS_POPUP OR WS_CAPTION OR WS_SYSMENU
function WndProc(sys hwnd, uMsg, wParam, lParam) as sys callback
string temp=space 256
int unit, x
select uMsg
case WM_CREATE
SetWindowText(hwnd, "Tom Lehrer - Who's next")
'Adjust color of MainWindow
SetClassLongPtr(hwnd,GCLP_HBRBACKGROUND, GetSysColorBrush(COLOR_3DFACE))
lbl[1]=CreateWindowEx(0,"static","",WS_CHILDWINDOW|WS_VISIBLE, 20, 30,360,25, hwnd,0,hinstance,0)
lbl[2]=CreateWindowEx(0,"static","",WS_CHILDWINDOW|WS_VISIBLE, 20, 55,360,25, hwnd,0,hinstance,0)
lbl[3]=CreateWindowEx(0,"static","",WS_CHILDWINDOW|WS_VISIBLE, 20, 80,360,25, hwnd,0,hinstance,0)
lbl[4]=CreateWindowEx(0,"static","",WS_CHILDWINDOW|WS_VISIBLE, 20,105,360,25, hwnd,0,hinstance,0)
lbl[5]=CreateWindowEx(0,"static","",WS_CHILDWINDOW|WS_VISIBLE, 20,130,360,25, hwnd,0,hinstance,0)
mciSendString("open whonext.mid type sequencer alias whonext", 0, 0, 0)
mciSendString("status whonext length", temp, 256,0)
unit=val(temp)
if unit=0 then
mbox "Cannot open whonext.mid. Sorry!"
SendMessage(hwnd, WM_CLOSE,0,0)
end if
if unit!=759 then
mbox "Wrong midi file. Sorry!"
SendMessage(hwnd, WM_CLOSE,0,0)
end if
mciSendString("play whonext", 0, 0, 0)
SetTimer(hwnd,1000,10,0)
/*
'check the position
case WM_LBUTTONDOWN
mciSendString("status whonext position", temp, 256,0)
unit=val(temp)
printl unit
*/
case WM_TIMER
mciSendString("status whonext position", temp, 256,0)
unit=val(temp)
select unit
case >= 725 : SetWindowText(lbl[4],lyrics[30]) : KillTimer(hwnd)
case >= 705 : SetWindowText(lbl[3],lyrics[29])
case >= 692 : SetWindowText(lbl[2],lyrics[28])
case >= 682 '6'
for x=1 to 5 : SetWindowText(lbl[x])="" : next
SetWindowText(lbl[1],lyrics[27])
case >= 660 : SetWindowText(lbl[4],lyrics[26])
case >= 636 : SetWindowText(lbl[3],lyrics[25])
case >= 617 : SetWindowText(lbl[2],lyrics[24])
case >= 596 '5'
for x=1 to 5 : SetWindowText(lbl[x])="" : next
SetWindowText(lbl[1],lyrics[23])
case >= 572 : SetWindowText(lbl[5],lyrics[22])
case >= 532 : SetWindowText(lbl[4],lyrics[21])
case >= 510 : SetWindowText(lbl[3],lyrics[20])
case >= 489 : SetWindowText(lbl[2],lyrics[19])
case >= 461 '4b'
for x=1 to 5 : SetWindowText(lbl[x])="" : next
SetWindowText(lbl[1],lyrics[18])
case >= 422 : SetWindowText(lbl[2],lyrics[17])
case >= 379 '4a'
for x=1 to 5 : SetWindowText(lbl[x])="" : next
SetWindowText(lbl[1],lyrics[16])
case >= 355 : SetWindowText(lbl[5],lyrics[15])
case >= 336 : SetWindowText(lbl[4],lyrics[14])
case >= 312 : SetWindowText(lbl[3],lyrics[13])
case >= 291 : SetWindowText(lbl[2],lyrics[12])
case >= 265 '3'
for x=1 to 5 : SetWindowText(lbl[x])="" : next
SetWindowText(lbl[1],lyrics[11])
case >= 245 : SetWindowText(lbl[5],lyrics[10])
case >= 228 : SetWindowText(lbl[4],lyrics[9])
case >= 205 : SetWindowText(lbl[3],lyrics[8])
case >= 185 : SetWindowText(lbl[2],lyrics[7])
case >= 165 '2'
for x=1 to 5 : SetWindowText(lbl[x])="" : next
SetWindowText(lbl[1],lyrics[6])
case >= 141 : SetWindowText(lbl[5],lyrics[5])
case >= 121 : SetWindowText(lbl[4],lyrics[4])
case >= 98 : SetWindowText(lbl[3],lyrics[3])
case >= 80 : SetWindowText(lbl[2],lyrics[2])
case >= 59 '1'
SetWindowText(lbl[1],lyrics[1])
end select
case WM_CLOSE
'Close whonext.mid file and sequencer device
mciSendString("close whonext", 0, 0, 0)
KillTimer(hwnd)
DestroyWindow(hwnd)
case WM_DESTROY
PostQuitMessage(0)
case else
return DefWindowProc(hwnd, uMsg, wParam, lParam)
end select
return 0
end function
'Tom Lehrer - Who's next (1965)
sub loadlyrics()
lyrics[]={
"First we got the bomb, and that was good,",
"'Cause we love peace and motherhood.",
"Then Russia got the bomb, but that's okay,",
"'Cause the balance of power's maintained that way.",
"Who's next?",
"Then France got the bomb, but don't you grieve,",
"'Cause they're on our side (I believe).",
"China got the bomb, but have no fears,",
"'Cause they can't wipe us out for a least five years.",
"Who's next?",
"Japan will have its own device,",
"Transistorized at half the price.",
"South Africa wants two, that's right:",
"One for the black and one for the white.",
"Who's next?",
"Egypt's gonna get one too,",
"Just to use on you-know-who.",
"So Israel's getting tense,",
"Wants one in self defense.",
"The Lord's our shepherd says the psalm,",
"But just in case, we better get a bomb.",
"Who's next?",
"Luxembourg is next to go,",
"And (who knows?) maybe Monaco.",
"We'll try to stay serene and calm",
"When Alabama gets the bomb.",
"Who's next?",
"Who's next?",
"Who's next?",
"Who's next??"
}
end sub