Sound loops

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2544 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-05-10 21:45:48 +00:00
parent a0854211b5
commit deefa7415c
3 changed files with 13 additions and 6 deletions

View file

@ -323,14 +323,20 @@ NSISFunc(Destroy) {
} }
NSISFunc(Sound) { NSISFunc(Sound) {
DWORD flags = SND_FILENAME|SND_NODEFAULT|SND_NOWAIT; char szLoop[] = {'/', 'L', 'O', 'O', 'P', 0};
DWORD flags = SND_FILENAME | SND_NODEFAULT;
g_stacktop=stacktop; g_stacktop=stacktop;
popstring(szTemp); popstring(szTemp);
if (lstrcmpi(szTemp, "/WAIT")) if (lstrcmpi(szTemp, "/WAIT"))
flags |= SND_ASYNC; flags |= SND_ASYNC;
else else
popstring(szTemp); popstring(szTemp);
PlaySound(szTemp, 0, flags); if (!lstrcmpi(szTemp, szLoop)) {
flags |= SND_LOOP;
popstring(szTemp);
}
PlaySound(lstrcmpi(szTemp, "/STOP") ? szTemp : 0, 0, flags);
} }
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
@ -396,11 +402,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (img->iType == MIL_TEXT) { if (img->iType == MIL_TEXT) {
SetBkMode(hdc, TRANSPARENT); SetBkMode(hdc, TRANSPARENT);
HFONT hOldFont;
SetTextColor(hdc, img->cTextColor); SetTextColor(hdc, img->cTextColor);
hOldFont = (HFONT)SelectObject(hdc, img->hFont); SelectObject(hdc, img->hFont);
DrawText(hdc, img->szText, -1, &img->rPos, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_WORDBREAK); DrawText(hdc, img->szText, -1, &img->rPos, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_WORDBREAK);
SelectObject(hdc, hOldFont);
} }
else if (img->iType == MIL_BITMAP) { else if (img->iType == MIL_BITMAP) {
HDC cdc = CreateCompatibleDC(hdc); HDC cdc = CreateCompatibleDC(hdc);

View file

@ -69,9 +69,12 @@ Destroy
Destroys the current background window Destroys the current background window
Destroy calls Clear automatically Destroy calls Clear automatically
Sound [/WAIT] path_to_wav Sound [/WAIT|/LOOP] path_to_wav
Sound /STOP
Plays a wave file Plays a wave file
Use /WAIT to wait for the sound to finish playing Use /WAIT to wait for the sound to finish playing
Use /LOOP to loop the sound
Use Sound /STOP to stop the loop
SetReturn on|off SetReturn on|off
Enable return values from SetBg, AddImage and AddText Enable return values from SetBg, AddImage and AddText

Binary file not shown.