--- mstools/samples/playsnd/playsnd.c 2018/08/09 18:21:49 1.1 +++ mstools/samples/playsnd/playsnd.c 2018/08/09 18:23:57 1.1.1.2 @@ -14,6 +14,7 @@ HANDLE ghModule; // globa char szAppName[SIZEOFAPPNAME]; // app name HWND ghwndMain; // handle of main window BOOL bNoWait; +BOOL bNoDefault = SND_NODEFAULT; BOOL bSync; BOOL bResourceID; @@ -35,17 +36,17 @@ int _CRTAPI1 main(int argc, char *argv[] if (argc > 1) { // assume that the first arg is a filename - dprintf1("Calling PLAYSOUND to play %s", argv[1]); + dprintf1(("Calling PLAYSOUND to play %s", argv[1])); WinAssert(SND_ASYNC); - PlaySound(argv[1], NULL, SND_SYNC | SND_FILENAME); + PlaySound(argv[1], NULL, SND_SYNC | SND_FILENAME | bNoDefault); return 0; } // try to init the main part of the app if (! InitApp()) { - dprintf("Failed to initialise correctly"); + dprintf(("Failed to initialise correctly")); return 1; } @@ -84,12 +85,19 @@ int APIENTRY MainWndProc(HWND hWnd, UINT case WM_INITMENUPOPUP: // show the option flag states - dprintf("WM_INITMENUPOPUP %8x %8x %8x",hWnd, wParam, lParam); + dprintf2(("WM_INITMENUPOPUP %8x %8x %8x",hWnd, wParam, lParam)); hMenu = GetMenu(hWnd); CheckMenuItem(hMenu, IDM_SYNC, bSync ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu, IDM_NOWAIT, bNoWait ? MF_CHECKED : MF_UNCHECKED); + + // Note: we are slightly naughty here. bNoDefault is not a true + // boolean value. It will contain SND_NODEFAULT or NULL + CheckMenuItem(hMenu, IDM_NODEFAULT, bNoDefault ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, IDM_RESOURCEID, bResourceID ? MF_CHECKED : MF_UNCHECKED); + ModifyMenu(hMenu, IDM_HELP_KEYBOARD, MF_GRAYED | MF_STRING, IDM_HELP_KEYBOARD, "&Keyboard"); + #ifdef MEDIA_DEBUG CheckMenuItem(hMenu, (__iDebugLevel + IDM_DEBUG0), MF_CHECKED); #endif @@ -159,6 +167,14 @@ void CommandMsg(HWND hWnd, DWORD wParam) bNoWait = !bNoWait; break; + case IDM_NODEFAULT: + if (bNoDefault) { + bNoDefault = 0; + } else { + bNoDefault = SND_NODEFAULT; + } + break; + case IDM_ABOUT: About(hWnd); break; @@ -232,9 +248,9 @@ void MyBeep(DWORD wParam) } if (lpstr) { - dprintf2("Calling Message beep with flags %8x Type %s", dwFlags, lpstr); + dprintf2(("Calling Message beep with flags %8x Type %s", dwFlags, lpstr)); MessageBeep((UINT)dwFlags); - dprintf2("Now calling MessageBox"); + dprintf2(("Now calling MessageBox")); MessageBox(ghwndMain, lpstr, szAppName, (UINT)dwFlags); } }