Using this code (mostly just added the irvine32.inc to the github code here: https://gist.github.com/michaellindahl/7782978
TITLE MASM PlaySound (PlaySoundExample.asm)
includelib winmm.lib
INCLUDE Irvine32.inc
INCLUDE macros.inc
PlaySound PROTO,
pszSound:PTR BYTE,
hmod:DWORD,
fdwSound:DWORD
.data
deviceConnect BYTE "DeviceConnect",0
SND_ALIAS DWORD 00010000h
SND_RESOURCE DWORD 00040005h
SND_FILENAME DWORD 00020000h
file BYTE "t.wav",0
.code
main PROC
INVOKE PlaySound, OFFSET deviceConnect, NULL, SND_ALIAS
INVOKE PlaySound, OFFSET file, NULL, SND_FILENAME
exit
main ENDP
END main
You need to add
SND_ASYNC
flag additionally.In MASM32, you need to
OR
their binary bits, so your function arg has both bits set likeSND_ASYNC | SND_FILENAME
in C.Code Sample: