Annotation of mstools/samples/playsnd/res.c, revision 1.1.1.2

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.