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.

128 lines
2.9 KiB

  1. /****************************************************************************
  2. *
  3. * options.c
  4. *
  5. * Copyright (c) 1991 Microsoft Corporation. All Rights Reserved.
  6. *
  7. ***************************************************************************/
  8. #include <windows.h>
  9. #include <mmsystem.h>
  10. #include "wincom.h"
  11. #include "sbtest.h"
  12. void WaveOptions(HWND hWnd)
  13. {
  14. FARPROC fpDlg;
  15. // show the wave options dialog box
  16. fpDlg = MakeProcInstance(WaveOptionsDlgProc, ghInst);
  17. DialogBox(ghInst, "Options", hWnd, fpDlg);
  18. FreeProcInstance(fpDlg);
  19. }
  20. int FAR PASCAL WaveOptionsDlgProc(HWND hDlg, unsigned msg, UINT wParam, LONG lParam)
  21. {
  22. char szPath[_MAX_PATH];
  23. switch (msg) {
  24. case WM_INITDIALOG:
  25. GetProfileString(szAppName, "wavpath", "", szPath, sizeof(szPath));
  26. SetDlgItemText(hDlg, IDO_WAVPATH, szPath);
  27. GetProfileString(szAppName, "profpath", "", szPath, sizeof(szPath));
  28. SetDlgItemText(hDlg, IDO_PROFPATH, szPath);
  29. break;
  30. case WM_COMMAND:
  31. switch (wParam) {
  32. case IDOK:
  33. GetDlgItemText(hDlg, IDO_WAVPATH, szPath, sizeof(szPath));
  34. WriteProfileString(szAppName, "wavpath", szPath);
  35. GetDlgItemText(hDlg, IDO_PROFPATH, szPath, sizeof(szPath));
  36. WriteProfileString(szAppName, "profpath", szPath);
  37. EndDialog(hDlg, TRUE);
  38. break;
  39. case IDCANCEL:
  40. EndDialog(hDlg, FALSE);
  41. break;
  42. default:
  43. break;
  44. }
  45. break;
  46. default:
  47. return FALSE;
  48. break;
  49. }
  50. return TRUE;
  51. }
  52. void MidiOptions(HWND hWnd)
  53. {
  54. FARPROC fpDlg;
  55. // show the midi options dialog box */
  56. fpDlg = MakeProcInstance(MidiOptionsDlgProc, ghInst);
  57. DialogBox(ghInst, "Optionsm", hWnd, fpDlg);
  58. FreeProcInstance(fpDlg);
  59. }
  60. int FAR PASCAL MidiOptionsDlgProc(HWND hDlg, unsigned msg, UINT wParam, LONG lParam)
  61. {
  62. static int iInstBase;
  63. char szNum[2];
  64. switch (msg) {
  65. case WM_INITDIALOG:
  66. CheckRadioButton(hDlg, IDD_ZERO, IDD_ONE, gInstBase?IDD_ONE:IDD_ZERO);
  67. iInstBase = gInstBase;
  68. break;
  69. case WM_COMMAND:
  70. switch (wParam) {
  71. case IDD_ZERO:
  72. CheckRadioButton(hDlg, IDD_ZERO, IDD_ONE, IDD_ZERO);
  73. iInstBase = 0;
  74. break;
  75. case IDD_ONE:
  76. CheckRadioButton(hDlg, IDD_ZERO, IDD_ONE, IDD_ONE);
  77. iInstBase = 1;
  78. break;
  79. case IDOK:
  80. if (gInstBase != iInstBase) {
  81. szNum[0] = '0' + (char)iInstBase;
  82. szNum[1] = 0;
  83. WriteProfileString(szAppName, "InstrumentBase", szNum);
  84. InvalidateRect(hInstWnd, NULL, TRUE);
  85. gInstBase = iInstBase;
  86. }
  87. EndDialog(hDlg, TRUE);
  88. break;
  89. case IDCANCEL:
  90. EndDialog(hDlg, FALSE);
  91. break;
  92. default:
  93. break;
  94. }
  95. break;
  96. default:
  97. return FALSE;
  98. break;
  99. }
  100. return TRUE;
  101. }