From MSDN:
Perhaps calling ShellExecute is one of those things you can't do. Also, it could be that user32.dll (the DLL which ShellExecute is located in) gets unloaded before that code is run so nothing happens. Beep exists in kernel32.dll and is normally the first to be loaded in a process and the last to be unloaded.Originally Posted by MSDN