Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
940 B

  1. /*
  2. res.c
  3. Resource menu stuff
  4. */
  5. #include <stdlib.h>
  6. #include <windows.h>
  7. #include "PlaySnd.h"
  8. void Resource(DWORD wParam)
  9. {
  10. char *name;
  11. DWORD dwFlags;
  12. switch (wParam) {
  13. case IDM_DING:
  14. name = "ding";
  15. break;
  16. case IDM_SIREN:
  17. name = "siren";
  18. break;
  19. case IDM_LASER:
  20. name = "laser";
  21. break;
  22. default:
  23. name = NULL;
  24. Error("Don't know how to play that");
  25. break;
  26. }
  27. if (bResourceID) {
  28. name = (LPSTR)wParam;
  29. }
  30. if (name) {
  31. dwFlags = SND_RESOURCE;
  32. if (bSync) {
  33. WinAssert(!SND_SYNC);
  34. } else {
  35. dwFlags |= SND_ASYNC;
  36. }
  37. if (bNoWait) dwFlags |= SND_NOWAIT;
  38. if (!PlaySound(name, ghModule, dwFlags | bNoDefault)) {
  39. if (HIWORD(name)) {
  40. Error("Failed to play resource: %s (by name)", name);
  41. } else {
  42. Error("Failed to play resource: %x (by ID)", name);
  43. }
  44. }
  45. }
  46. }