I think I've found the problem:
If you want to play a system sound (not a wav file) this function doesn't need a string containing the ID of the sound you want to play, but a pointer to a string containing that ID.
So, from PB, this call is wrong:
PlaySoundW("18515", ll_null, SND_ALIAS_ID)
In c++ the correct call is:
PlaySoundW((LPCWSTR)SND_ALIAS_SYSTEMEXCLAMATION, NULL, SND_ALIAS_ID);
SND_ALIAS_SYSTEMEXCLAMATION is not converted to string, but to a "long pointer to string".
I don't know if it is possible to make this call from PB.
To solve this problem I had to make a dll in c++ that wraps these calls