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.

700 lines
20 KiB

  1. /*
  2. ***************************************************************
  3. * video.c
  4. *
  5. * Copyright (C) Microsoft, 1990, All Rights Reserved.
  6. *
  7. * Displays the Simple media properties
  8. *
  9. * History:
  10. *
  11. * July 1994 -by- VijR (Created)
  12. *
  13. ***************************************************************
  14. */
  15. #include "mmcpl.h"
  16. #include <windowsx.h>
  17. #ifdef DEBUG
  18. #undef DEBUG
  19. #include <mmsystem.h>
  20. #define DEBUG
  21. #else
  22. #include <mmsystem.h>
  23. #endif
  24. #include <commctrl.h>
  25. #include <prsht.h>
  26. #include "utils.h"
  27. #include "medhelp.h"
  28. #include "profile.key" // For ROOTKEY and KEYNAME etc
  29. #define Assert(f)
  30. /*
  31. ***************************************************************
  32. * Defines
  33. ***************************************************************
  34. */
  35. //
  36. // !!! These actually live in mciavi\graphic.h
  37. // !!! If MCIAVI changes these, we're hosed!
  38. //
  39. #define MCIAVIO_ZOOMBY2 0x00000100
  40. #define MCIAVIO_USEVGABYDEFAULT 0x00000200
  41. #define MCIAVIO_1QSCREENSIZE 0x00010000
  42. #define MCIAVIO_2QSCREENSIZE 0x00020000
  43. #define MCIAVIO_3QSCREENSIZE 0x00040000
  44. #define MCIAVIO_MAXWINDOWSIZE 0x00080000
  45. #define MCIAVIO_DEFWINDOWSIZE 0x00000000
  46. #define MCIAVIO_WINDOWSIZEMASK 0x000f0000
  47. // This bit is set in dwOptions if f16BitCompat, but doesn't get written back
  48. // directly into the registry's version of that DWORD.
  49. //
  50. #define MCIAVIO_F16BITCOMPAT 0x00000001
  51. /*
  52. ***************************************************************
  53. * File Globals
  54. ***************************************************************
  55. */
  56. static SZCODE aszMCIAVIOpt[] = TEXT("Software\\Microsoft\\Multimedia\\Video For Windows\\MCIAVI");
  57. static SZCODE aszDefVideoOpt[] = TEXT("DefaultOptions");
  58. static SZCODE aszReject[] = TEXT("RejectWOWOpenCalls");
  59. static SZCODE aszRejectSection[] = TEXT("MCIAVI");
  60. HBITMAP g_hbmMonitor = NULL; // monitor bitmap (original)
  61. HBITMAP g_hbmScrSample = NULL; // bitmap used for IDC_SCREENSAMPLE
  62. HBITMAP g_hbmDefault = NULL;
  63. HDC g_hdcMem = NULL;
  64. /*
  65. ***************************************************************
  66. * Prototypes
  67. ***************************************************************
  68. */
  69. BOOL PASCAL DoVideoCommand(HWND hDlg, int id, HWND hwndCtl, UINT codeNotify);
  70. /*
  71. ***************************************************************
  72. ***************************************************************
  73. */
  74. // mmGetProfileInt/mmWriteProfileInt snitched from MCIAVI32
  75. UINT
  76. mmGetProfileInt(LPCTSTR appname, LPCTSTR valuename, INT uDefault)
  77. {
  78. TCHAR achName[MAX_PATH];
  79. HKEY hkey;
  80. DWORD dwType;
  81. INT value = uDefault;
  82. DWORD dwData;
  83. int cbData;
  84. lstrcpy(achName, KEYNAME);
  85. lstrcat(achName, appname);
  86. if (RegOpenKey(ROOTKEY, achName, &hkey) == ERROR_SUCCESS) {
  87. cbData = sizeof(dwData);
  88. if (RegQueryValueEx(
  89. hkey,
  90. (LPTSTR)valuename,
  91. NULL,
  92. &dwType,
  93. (PBYTE) &dwData,
  94. &cbData) == ERROR_SUCCESS) {
  95. if (dwType == REG_DWORD) {
  96. value = (INT)dwData;
  97. }
  98. }
  99. RegCloseKey(hkey);
  100. }
  101. return((UINT)value);
  102. }
  103. /*
  104. * write a UINT to the profile, if it is not the
  105. * same as the default or the value already there
  106. */
  107. VOID
  108. mmWriteProfileInt(LPCTSTR appname, LPCTSTR valuename, INT Value)
  109. {
  110. // If we would write the same as already there... return.
  111. if (mmGetProfileInt(appname, valuename, !Value) == (UINT)Value) {
  112. return;
  113. }
  114. {
  115. TCHAR achName[MAX_PATH];
  116. HKEY hkey = NULL;
  117. lstrcpy(achName, KEYNAME);
  118. lstrcat(achName, appname);
  119. if ((RegCreateKey (ROOTKEY, achName, &hkey) == ERROR_SUCCESS) && hkey)
  120. {
  121. RegSetValueEx(
  122. hkey,
  123. valuename,
  124. 0,
  125. REG_DWORD,
  126. (PBYTE) &Value,
  127. sizeof(Value)
  128. );
  129. RegCloseKey(hkey);
  130. }
  131. }
  132. }
  133. /*
  134. ***************************************************************
  135. ***************************************************************
  136. */
  137. STATIC void WriteVideoOptions(DWORD dwOpt)
  138. {
  139. HKEY hkVideoOpt;
  140. BOOL f16BitCompat;
  141. f16BitCompat = (dwOpt & MCIAVIO_F16BITCOMPAT) ? TRUE : FALSE;
  142. dwOpt &= ~MCIAVIO_F16BITCOMPAT;
  143. if(RegCreateKeyEx( HKEY_CURRENT_USER, (LPTSTR)aszMCIAVIOpt, 0, NULL, 0,KEY_WRITE | KEY_READ, NULL, &hkVideoOpt, NULL ))
  144. return;
  145. RegSetValueEx( hkVideoOpt, (LPTSTR)aszDefVideoOpt, 0, REG_DWORD,(LPBYTE)&dwOpt, sizeof(DWORD) );
  146. mmWriteProfileInt (aszRejectSection, aszReject, (int)f16BitCompat);
  147. RegCloseKey(hkVideoOpt);
  148. }
  149. STATIC DWORD ReadVideoOptions(void)
  150. {
  151. HKEY hkVideoOpt;
  152. DWORD dwType;
  153. DWORD dwOpt;
  154. DWORD cbSize;
  155. if(RegCreateKeyEx( HKEY_CURRENT_USER, (LPTSTR)aszMCIAVIOpt, 0, NULL, 0,KEY_WRITE | KEY_READ, NULL, &hkVideoOpt, NULL ))
  156. return 0 ;
  157. cbSize = sizeof(DWORD);
  158. if (RegQueryValueEx( hkVideoOpt,(LPTSTR)aszDefVideoOpt,NULL,&dwType,(LPBYTE)&dwOpt,&cbSize ))
  159. {
  160. dwOpt = 0;
  161. RegSetValueEx( hkVideoOpt, (LPTSTR)aszDefVideoOpt, 0, REG_DWORD,(LPBYTE)&dwOpt, sizeof(DWORD) );
  162. }
  163. if (mmGetProfileInt (aszRejectSection, aszReject, 0))
  164. {
  165. dwOpt |= MCIAVIO_F16BITCOMPAT;
  166. }
  167. RegCloseKey(hkVideoOpt);
  168. return dwOpt;
  169. }
  170. STATIC void FillWindowSizeCB(DWORD dwOptions, HWND hCBWinSize)
  171. {
  172. TCHAR sz1QScreenSize[64];
  173. TCHAR sz2QScreenSize[64];
  174. TCHAR sz3QScreenSize[64];
  175. TCHAR szMaxSize[64];
  176. TCHAR szOriginalSize[64];
  177. TCHAR szZoomedSize[64];
  178. int iIndex;
  179. LPTSTR lpszCurDefSize;
  180. LoadString(ghInstance, IDS_NORMALSIZE, szOriginalSize, sizeof(szOriginalSize)/sizeof(TCHAR));
  181. LoadString(ghInstance, IDS_ZOOMEDSIZE, szZoomedSize, sizeof(szZoomedSize)/sizeof(TCHAR));
  182. LoadString(ghInstance, IDS_1QSCREENSIZE, sz1QScreenSize, sizeof(sz1QScreenSize)/sizeof(TCHAR));
  183. LoadString(ghInstance, IDS_2QSCREENSIZE, sz2QScreenSize, sizeof(sz2QScreenSize)/sizeof(TCHAR));
  184. LoadString(ghInstance, IDS_3QSCREENSIZE, sz3QScreenSize, sizeof(sz3QScreenSize)/sizeof(TCHAR));
  185. LoadString(ghInstance, IDS_VIDEOMAXIMIZED, szMaxSize, sizeof(szMaxSize)/sizeof(TCHAR));
  186. iIndex = ComboBox_AddString(hCBWinSize, szOriginalSize);
  187. ComboBox_SetItemData(hCBWinSize, iIndex, (LPARAM)MCIAVIO_DEFWINDOWSIZE);
  188. iIndex = ComboBox_AddString(hCBWinSize, szZoomedSize);
  189. ComboBox_SetItemData(hCBWinSize, iIndex, (LPARAM)MCIAVIO_ZOOMBY2);
  190. iIndex = ComboBox_AddString(hCBWinSize, sz1QScreenSize);
  191. ComboBox_SetItemData(hCBWinSize, iIndex, (LPARAM)MCIAVIO_1QSCREENSIZE);
  192. iIndex = ComboBox_AddString(hCBWinSize, sz2QScreenSize);
  193. ComboBox_SetItemData(hCBWinSize, iIndex, (LPARAM)MCIAVIO_2QSCREENSIZE);
  194. iIndex = ComboBox_AddString(hCBWinSize, sz3QScreenSize);
  195. ComboBox_SetItemData(hCBWinSize, iIndex, (LPARAM)MCIAVIO_3QSCREENSIZE);
  196. iIndex = ComboBox_AddString(hCBWinSize, szMaxSize);
  197. ComboBox_SetItemData(hCBWinSize, iIndex, (LPARAM)MCIAVIO_MAXWINDOWSIZE);
  198. switch(dwOptions & MCIAVIO_WINDOWSIZEMASK)
  199. {
  200. case MCIAVIO_DEFWINDOWSIZE:
  201. if (dwOptions & MCIAVIO_ZOOMBY2)
  202. lpszCurDefSize = szZoomedSize;
  203. else
  204. lpszCurDefSize = szOriginalSize;
  205. break;
  206. case MCIAVIO_1QSCREENSIZE:
  207. lpszCurDefSize = sz1QScreenSize;
  208. break;
  209. case MCIAVIO_2QSCREENSIZE:
  210. lpszCurDefSize = sz2QScreenSize;
  211. break;
  212. case MCIAVIO_3QSCREENSIZE:
  213. lpszCurDefSize = sz3QScreenSize;
  214. break;
  215. case MCIAVIO_MAXWINDOWSIZE:
  216. lpszCurDefSize = szMaxSize;
  217. break;
  218. }
  219. //
  220. // We should select string that matches exactly.
  221. //
  222. iIndex = ComboBox_FindStringExact(hCBWinSize, 0, lpszCurDefSize);
  223. ComboBox_SetCurSel(hCBWinSize, iIndex);
  224. }
  225. /*---------------------------------------------------------
  226. **
  227. **---------------------------------------------------------*/
  228. // information about the monitor bitmap
  229. // x, y, dx, dy define the size of the "screen" part of the bitmap
  230. // the RGB is the color of the screen's desktop
  231. // these numbers are VERY hard-coded to a monitor bitmap
  232. #define MON_X 16
  233. #define MON_Y 17
  234. #define MON_DX 152
  235. #define MON_DY 112
  236. #define MON_IMAGE_X (MON_X + 46)
  237. #define MON_IMAGE_Y (MON_Y + 33)
  238. #define MON_IMAGE_DX 59
  239. #define MON_IMAGE_DY 44
  240. #define MON_TITLE 10
  241. #define MON_BORDER 2
  242. #define MON_TRAY 8
  243. STATIC HBITMAP FAR LoadMonitorBitmap( BOOL bFillDesktop )
  244. {
  245. HBITMAP hbm;
  246. hbm = (HBITMAP) LoadImage(ghInstance,MAKEINTATOM(IDB_MONITOR), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  247. Assert(hbm);
  248. return hbm;
  249. }
  250. /*------------------------pixel resolution---------------------------
  251. **
  252. ** show the sample screen with proper sizing
  253. */
  254. STATIC void NEAR PASCAL ShowSampleScreen(HWND hDlg, int iMCIWindowSize)
  255. {
  256. HBITMAP hbmOld;
  257. HBRUSH hbr;
  258. HDC hdcMem2;
  259. SIZE dSrc = {MON_IMAGE_DX, MON_IMAGE_DY};
  260. POINT ptSrc = {MON_IMAGE_X, MON_IMAGE_Y};
  261. SIZE dDst;
  262. POINT ptDst;
  263. RECT rcImage = {MON_IMAGE_X, MON_IMAGE_Y, MON_IMAGE_X + MON_IMAGE_DX, MON_IMAGE_Y + MON_IMAGE_DY};
  264. if (!g_hbmMonitor || !g_hbmScrSample)
  265. return;
  266. switch(iMCIWindowSize)
  267. {
  268. case MCIAVIO_DEFWINDOWSIZE:
  269. dDst = dSrc;
  270. ptDst = ptSrc;
  271. break;
  272. case MCIAVIO_ZOOMBY2:
  273. dDst.cx = 2 * dSrc.cx;
  274. dDst.cy = 2 * dSrc.cy;
  275. ptDst.x = ptSrc.x - (int)(dSrc.cx/2);
  276. ptDst.y = ptSrc.y - (int)(dSrc.cy/2);
  277. break;
  278. case MCIAVIO_MAXWINDOWSIZE:
  279. ptDst.x = MON_X;
  280. ptDst.y = MON_Y;
  281. dDst.cx = MON_DX;
  282. dDst.cy = MON_DY - MON_TRAY;
  283. break;
  284. case MCIAVIO_1QSCREENSIZE:
  285. dDst.cx = MulDiv(MON_DX, 1, 4);
  286. dDst.cy = MulDiv(MON_DY, 1, 4);
  287. ptDst.x = MON_X + MulDiv((MON_DX - dDst.cx), 1 , 2);
  288. ptDst.y = MON_Y + MulDiv((MON_DY - dDst.cy - MON_TRAY), 1 , 2);
  289. break;
  290. case MCIAVIO_2QSCREENSIZE:
  291. dDst.cx = MulDiv(MON_DX, 1, 2);
  292. dDst.cy = MulDiv(MON_DY, 1, 2);
  293. ptDst.x = MON_X + MulDiv((MON_DX - dDst.cx), 1 , 2);
  294. ptDst.y = MON_Y + MulDiv((MON_DY - dDst.cy - MON_TRAY), 1 , 2);
  295. break;
  296. case MCIAVIO_3QSCREENSIZE:
  297. dDst.cx = MulDiv(MON_DX, 3, 4);
  298. dDst.cy = MulDiv(MON_DY, 3, 4);
  299. ptDst.x = MON_X + MulDiv((MON_DX - dDst.cx), 1 , 2);
  300. ptDst.y = MON_Y + MulDiv((MON_DY - dDst.cy - MON_TRAY), 1 , 2);
  301. break;
  302. case MCIAVIO_USEVGABYDEFAULT:
  303. dDst.cx = MON_DX;
  304. dDst.cy = MON_DY;
  305. ptDst.x = MON_X;
  306. ptDst.y = MON_Y;
  307. dSrc.cx = MON_IMAGE_DX - (2 * MON_BORDER);
  308. dSrc.cy = MON_IMAGE_DY - MON_TITLE - MON_BORDER;
  309. ptSrc.x = MON_IMAGE_X + MON_BORDER;
  310. ptSrc.y = MON_IMAGE_Y + MON_TITLE + MON_BORDER;
  311. break;
  312. }
  313. // set up a work area to play in
  314. hdcMem2 = CreateCompatibleDC(g_hdcMem);
  315. if (!hdcMem2)
  316. return;
  317. SelectObject(hdcMem2, g_hbmScrSample);
  318. hbmOld = SelectObject(g_hdcMem, g_hbmMonitor);
  319. //copy the whole bmp first and then start stretching
  320. BitBlt(hdcMem2, MON_X, MON_Y, MON_DX, MON_DY, g_hdcMem, MON_X, MON_Y, SRCCOPY);
  321. //Wipe out the existing Image
  322. hbr = CreateSolidBrush( GetPixel( g_hdcMem, MON_X + 1, MON_Y + 1 ) );
  323. if (!hbr)
  324. {
  325. DeleteObject( hdcMem2 );
  326. return;
  327. }
  328. FillRect(hdcMem2, &rcImage, hbr);
  329. DeleteObject( hbr );
  330. // stretch the image to reflect the new size
  331. SetStretchBltMode( hdcMem2, COLORONCOLOR );
  332. StretchBlt( hdcMem2, ptDst.x, ptDst.y, dDst.cx, dDst.cy,
  333. g_hdcMem, ptSrc.x, ptSrc.y, dSrc.cx, dSrc.cy, SRCCOPY );
  334. SelectObject( hdcMem2, g_hbmDefault );
  335. DeleteObject( hdcMem2 );
  336. SelectObject( g_hdcMem, hbmOld );
  337. InvalidateRect(GetDlgItem(hDlg, IDC_SCREENSAMPLE), NULL, FALSE);
  338. }
  339. STATIC void DoMonitorBmp(HWND hDlg)
  340. {
  341. HDC hdc = GetDC(NULL);
  342. HBITMAP hbm;
  343. g_hdcMem = CreateCompatibleDC(hdc);
  344. ReleaseDC(NULL, hdc);
  345. if (!g_hdcMem)
  346. return;
  347. hbm = CreateBitmap(1,1,1,1,NULL);
  348. if (!hbm) return;
  349. g_hbmDefault = SelectObject(g_hdcMem, hbm);
  350. SelectObject(g_hdcMem, g_hbmDefault);
  351. DeleteObject(hbm);
  352. // set up bitmaps for sample screen
  353. g_hbmScrSample = LoadMonitorBitmap( TRUE ); // let them do the desktop
  354. SendDlgItemMessage(hDlg, IDC_SCREENSAMPLE, STM_SETIMAGE, IMAGE_BITMAP, (DWORD_PTR)g_hbmScrSample);
  355. // get a base copy of the bitmap for when the "internals" change
  356. g_hbmMonitor = LoadMonitorBitmap( FALSE ); // we'll do the desktop
  357. }
  358. const static DWORD aAdvVideoDlgHelpIds[] = { // Context Help IDs
  359. (DWORD)IDC_STATIC, IDH_VIDEO_ADVANCED_COMPAT,
  360. ID_ADVVIDEO_COMPAT, IDH_VIDEO_ADVANCED_COMPAT,
  361. 0, 0
  362. };
  363. INT_PTR AdvancedVideoDlgProc (HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam)
  364. {
  365. static BOOL *pfCompat = NULL;
  366. switch (wMsg)
  367. {
  368. case WM_INITDIALOG:
  369. {
  370. if ((pfCompat = (BOOL *)lParam) == NULL)
  371. return -1;
  372. CheckDlgButton (hDlg, ID_ADVVIDEO_COMPAT, (*pfCompat));
  373. break;
  374. }
  375. case WM_COMMAND:
  376. {
  377. switch (GET_WM_COMMAND_ID(wParam, lParam))
  378. {
  379. case IDOK:
  380. *pfCompat = IsDlgButtonChecked (hDlg, ID_ADVVIDEO_COMPAT);
  381. // fall through
  382. case IDCANCEL:
  383. EndDialog (hDlg, GET_WM_COMMAND_ID(wParam, lParam));
  384. break;
  385. }
  386. break;
  387. }
  388. case WM_CONTEXTMENU:
  389. {
  390. WinHelp ((HWND)wParam, NULL, HELP_CONTEXTMENU,
  391. (UINT_PTR)aAdvVideoDlgHelpIds);
  392. return TRUE;
  393. }
  394. case WM_HELP:
  395. {
  396. WinHelp (((LPHELPINFO)lParam)->hItemHandle, NULL,
  397. HELP_WM_HELP, (UINT_PTR)aAdvVideoDlgHelpIds);
  398. return TRUE;
  399. }
  400. }
  401. return FALSE;
  402. }
  403. const static DWORD aVideoDlgHelpIds[] = { // Context Help IDs
  404. IDC_GROUPBOX, IDH_COMM_GROUPBOX,
  405. IDC_SCREENSAMPLE, IDH_VIDEO_GRAPHIC,
  406. IDC_VIDEO_FULLSCREEN, IDH_VIDEO_FULL_SCREEN,
  407. IDC_VIDEO_INWINDOW, IDH_VIDEO_FIXED_WINDOW,
  408. IDC_VIDEO_CB_SIZE, IDH_VIDEO_FIXED_WINDOW,
  409. ID_VIDEO_ADVANCED, IDH_VIDEO_ADVANCED_BUTTON,
  410. 0, 0
  411. };
  412. BOOL CALLBACK VideoDlg(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  413. {
  414. NMHDR FAR *lpnm;
  415. switch (uMsg)
  416. {
  417. case WM_NOTIFY:
  418. lpnm = (NMHDR FAR *)lParam;
  419. switch(lpnm->code)
  420. {
  421. case PSN_KILLACTIVE:
  422. FORWARD_WM_COMMAND(hDlg, IDOK, 0, 0, SendMessage);
  423. break;
  424. case PSN_APPLY:
  425. FORWARD_WM_COMMAND(hDlg, ID_APPLY, 0, 0, SendMessage);
  426. break;
  427. case PSN_SETACTIVE:
  428. FORWARD_WM_COMMAND(hDlg, ID_INIT, 0, 0, SendMessage);
  429. break;
  430. case PSN_RESET:
  431. FORWARD_WM_COMMAND(hDlg, IDCANCEL, 0, 0, SendMessage);
  432. break;
  433. }
  434. break;
  435. case WM_INITDIALOG:
  436. {
  437. DWORD dwOptions;
  438. dwOptions = ReadVideoOptions();
  439. FillWindowSizeCB(dwOptions, GetDlgItem(hDlg, IDC_VIDEO_CB_SIZE));
  440. SetWindowLongPtr(hDlg, DWLP_USER, (LPARAM)dwOptions);
  441. DoMonitorBmp(hDlg);
  442. if (IsFlagSet(dwOptions, MCIAVIO_USEVGABYDEFAULT))
  443. {
  444. CheckRadioButton(hDlg, IDC_VIDEO_INWINDOW, IDC_VIDEO_FULLSCREEN, IDC_VIDEO_FULLSCREEN);
  445. EnableWindow(GetDlgItem(hDlg, IDC_VIDEO_CB_SIZE), FALSE);
  446. ShowSampleScreen(hDlg, MCIAVIO_USEVGABYDEFAULT);
  447. break;
  448. }
  449. else
  450. {
  451. CheckRadioButton(hDlg, IDC_VIDEO_INWINDOW, IDC_VIDEO_FULLSCREEN, IDC_VIDEO_INWINDOW);
  452. EnableWindow(GetDlgItem(hDlg, IDC_VIDEO_CB_SIZE), TRUE);
  453. }
  454. ShowSampleScreen(hDlg, dwOptions & (MCIAVIO_WINDOWSIZEMASK|MCIAVIO_ZOOMBY2));
  455. break;
  456. }
  457. case WM_DESTROY:
  458. if (g_hbmScrSample)
  459. {
  460. DeleteObject(g_hbmScrSample);
  461. g_hbmScrSample = NULL;
  462. }
  463. if (g_hbmMonitor)
  464. {
  465. DeleteObject(g_hbmMonitor);
  466. g_hbmMonitor = NULL;
  467. }
  468. if (g_hbmDefault)
  469. {
  470. DeleteObject(g_hbmDefault);
  471. g_hbmDefault = NULL;
  472. }
  473. if (g_hdcMem)
  474. {
  475. DeleteDC(g_hdcMem);
  476. g_hdcMem = NULL;
  477. }
  478. break;
  479. case WM_DROPFILES:
  480. break;
  481. case WM_CONTEXTMENU:
  482. WinHelp ((HWND) wParam, NULL, HELP_CONTEXTMENU,
  483. (UINT_PTR) (LPTSTR) aVideoDlgHelpIds);
  484. return TRUE;
  485. case WM_HELP:
  486. {
  487. LPHELPINFO lphi = (LPVOID) lParam;
  488. WinHelp (lphi->hItemHandle, NULL, HELP_WM_HELP,
  489. (UINT_PTR) (LPTSTR) aVideoDlgHelpIds);
  490. return TRUE;
  491. }
  492. case WM_COMMAND:
  493. HANDLE_WM_COMMAND(hDlg, wParam, lParam, DoVideoCommand);
  494. break;
  495. }
  496. return FALSE;
  497. }
  498. BOOL PASCAL DoVideoCommand(HWND hDlg, int id, HWND hwndCtl, UINT codeNotify)
  499. {
  500. switch (id)
  501. {
  502. case ID_APPLY:
  503. {
  504. int iIndex;
  505. HWND hCBWinSize = GetDlgItem(hDlg,IDC_VIDEO_CB_SIZE);
  506. DWORD dwOldOpt;
  507. DWORD dwNewOpt;
  508. dwOldOpt = (DWORD)GetWindowLongPtr(hDlg, DWLP_USER);
  509. if(Button_GetCheck(GetDlgItem(hDlg, IDC_VIDEO_FULLSCREEN)))
  510. {
  511. dwNewOpt = MCIAVIO_USEVGABYDEFAULT;
  512. }
  513. else
  514. {
  515. iIndex = ComboBox_GetCurSel(hCBWinSize);
  516. dwNewOpt = (DWORD)ComboBox_GetItemData(hCBWinSize, iIndex);
  517. }
  518. ClearFlag(dwOldOpt,MCIAVIO_WINDOWSIZEMASK|MCIAVIO_USEVGABYDEFAULT|MCIAVIO_ZOOMBY2);
  519. SetFlag(dwOldOpt, dwNewOpt);
  520. WriteVideoOptions(dwOldOpt);
  521. SetWindowLongPtr(hDlg, DWLP_USER, (LPARAM)dwOldOpt);
  522. return TRUE;
  523. }
  524. case IDOK:
  525. break;
  526. case IDCANCEL:
  527. break;
  528. case IDC_VIDEO_FULLSCREEN:
  529. EnableWindow(GetDlgItem(hDlg, IDC_VIDEO_CB_SIZE), FALSE);
  530. PropSheet_Changed(GetParent(hDlg),hDlg);
  531. ShowSampleScreen(hDlg, MCIAVIO_USEVGABYDEFAULT);
  532. break;
  533. case IDC_VIDEO_INWINDOW:
  534. {
  535. HWND hwndCB = GetDlgItem(hDlg,IDC_VIDEO_CB_SIZE);
  536. int iIndex = ComboBox_GetCurSel(hwndCB);
  537. int iOpt = (int)ComboBox_GetItemData(hwndCB, iIndex);
  538. EnableWindow(GetDlgItem(hDlg, IDC_VIDEO_CB_SIZE), TRUE);
  539. PropSheet_Changed(GetParent(hDlg),hDlg);
  540. ShowSampleScreen(hDlg, iOpt);
  541. break;
  542. }
  543. case IDC_VIDEO_CB_SIZE:
  544. switch (codeNotify)
  545. {
  546. case CBN_SELCHANGE:
  547. {
  548. int iIndex = ComboBox_GetCurSel(hwndCtl);
  549. int iOpt = (int)ComboBox_GetItemData(hwndCtl, iIndex);
  550. PropSheet_Changed(GetParent(hDlg),hDlg);
  551. ShowSampleScreen(hDlg, iOpt);
  552. break;
  553. }
  554. default:
  555. break;
  556. }
  557. break;
  558. case ID_VIDEO_ADVANCED:
  559. {
  560. INT_PTR f16BitCompat;
  561. f16BitCompat = (GetWindowLongPtr(hDlg, DWLP_USER) & MCIAVIO_F16BITCOMPAT);
  562. if (DialogBoxParam (ghInstance,
  563. MAKEINTRESOURCE(ADVVIDEODLG),
  564. hDlg,
  565. AdvancedVideoDlgProc,
  566. (LPARAM)&f16BitCompat) == IDOK)
  567. {
  568. SetWindowLongPtr (hDlg, DWLP_USER,
  569. GetWindowLongPtr (hDlg, DWLP_USER)
  570. & (~MCIAVIO_F16BITCOMPAT)
  571. | ((f16BitCompat) ? (MCIAVIO_F16BITCOMPAT) : 0));
  572. PropSheet_Changed(GetParent(hDlg),hDlg);
  573. }
  574. break;
  575. }
  576. case ID_INIT:
  577. break;
  578. }
  579. return FALSE;
  580. }