How to repeat a song using MCI command?
Here is my code.
.data
szMP3Format db "MPEGVideo",0
.code
LoadMP3File proc hWin:dword,NameOfFile:dword
LOCAL mciOpenParms:MCI_OPEN_PARMS,mciPlayParms:MCI_PLAY_PARMS
LOCAL MidDeviceID:dword
mov eax,hWin
mov mciPlayParms.dwCallback,eax
mov eax,OFFSET szMP3Format
mov mciOpenParms.lpstrDeviceType,eax
mov eax,NameOfFile
mov mciOpenParms.lpstrElementName,eax
invoke mciSendCommand,0,MCI_OPEN,MCI_OPEN_TYPE or MCI_OPEN_ELEMENT,ADDR mciOpenParms
mov eax,mciOpenParms.wDeviceID
mov MidDeviceID,eax
invoke mciSendCommand,MidDeviceID,MCI_PLAY,MCI_NOTIFY,ADDR mciPlayParms
mov eax,MidDeviceID
ret
LoadMP3File endp
PlayFile proc MidDeviceID:dword
LOCAL mciPlayParms:MCI_PLAY_PARMS
invoke mciSendCommand,MidDeviceID,MCI_PLAY,MCI_NOTIFY,ADDR mciPlayParms
ret
PlayFile endp
RepeatFile proc MidDeviceID:dword
LOCAL mciPlayParms:MCI_PLAY_PARMS
; Only repeating it 2 times and close
Invoke mciSendCommand, MidDeviceID, MCI_SEEK, MCI_SEEK_TO_START, addr mciPlayParms
Invoke mciSendCommand, MidDeviceID, MCI_PLAY, MCI_NOTIFY, addr mciPlayParms
ret
RepeatFile endp
Ah finally I found my mistake.
Just ignore this thread. I hope you find the code usefull.