/* *************************************************************** * video.c * * Copyright (C) Microsoft, 1990, All Rights Reserved. * * Displays the Simple media properties * * History: * * July 1994 -by- VijR (Created) * *************************************************************** */ #include "mmcpl.h" #include #ifdef DEBUG #undef DEBUG #include #define DEBUG #else #include #endif #include #include #include "utils.h" #include "medhelp.h" #include "profile.key" // For ROOTKEY and KEYNAME etc #define Assert(f) /* *************************************************************** * Defines *************************************************************** */ // // !!! These actually live in mciavi\graphic.h // !!! If MCIAVI changes these, we're hosed! // #define MCIAVIO_ZOOMBY2 0x00000100 #define MCIAVIO_USEVGABYDEFAULT 0x00000200 #define MCIAVIO_1QSCREENSIZE 0x00010000 #define MCIAVIO_2QSCREENSIZE 0x00020000 #define MCIAVIO_3QSCREENSIZE 0x00040000 #define MCIAVIO_MAXWINDOWSIZE 0x00080000 #define MCIAVIO_DEFWINDOWSIZE 0x00000000 #define MCIAVIO_WINDOWSIZEMASK 0x000f0000 // This bit is set in dwOptions if f16BitCompat, but doesn't get written back // directly into the registry's version of that DWORD. // #define MCIAVIO_F16BITCOMPAT 0x00000001 /* *************************************************************** * File Globals *************************************************************** */ static SZCODE aszMCIAVIOpt[] = TEXT("Software\\Microsoft\\Multimedia\\Video For Windows\\MCIAVI"); static SZCODE aszDefVideoOpt[] = TEXT("DefaultOptions"); static SZCODE aszReject[] = TEXT("RejectWOWOpenCalls"); static SZCODE aszRejectSection[] = TEXT("MCIAVI"); HBITMAP g_hbmMonitor = NULL; // monitor bitmap (original) HBITMAP g_hbmScrSample = NULL; // bitmap used for IDC_SCREENSAMPLE HBITMAP g_hbmDefault = NULL; HDC g_hdcMem = NULL; /* *************************************************************** * Prototypes *************************************************************** */ BOOL PASCAL DoVideoCommand(HWND hDlg, int id, HWND hwndCtl, UINT codeNotify); /* *************************************************************** *************************************************************** */ // mmGetProfileInt/mmWriteProfileInt snitched from MCIAVI32 UINT mmGetProfileInt(LPCTSTR appname, LPCTSTR valuename, INT uDefault) { TCHAR achName[MAX_PATH]; HKEY hkey; DWORD dwType; INT value = uDefault; DWORD dwData; int cbData; lstrcpy(achName, KEYNAME); if (appname) { if ((lstrlen(achName)+lstrlen(appname))hItemHandle, NULL, HELP_WM_HELP, (UINT_PTR)aAdvVideoDlgHelpIds); return TRUE; } } return FALSE; } const static DWORD aVideoDlgHelpIds[] = { // Context Help IDs IDC_GROUPBOX, IDH_COMM_GROUPBOX, IDC_SCREENSAMPLE, IDH_VIDEO_GRAPHIC, IDC_VIDEO_FULLSCREEN, IDH_VIDEO_FULL_SCREEN, IDC_VIDEO_INWINDOW, IDH_VIDEO_FIXED_WINDOW, IDC_VIDEO_CB_SIZE, IDH_VIDEO_FIXED_WINDOW, ID_VIDEO_ADVANCED, IDH_VIDEO_ADVANCED_BUTTON, 0, 0 }; BOOL CALLBACK VideoDlg(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { NMHDR FAR *lpnm; switch (uMsg) { case WM_NOTIFY: lpnm = (NMHDR FAR *)lParam; switch(lpnm->code) { case PSN_KILLACTIVE: FORWARD_WM_COMMAND(hDlg, IDOK, 0, 0, SendMessage); break; case PSN_APPLY: FORWARD_WM_COMMAND(hDlg, ID_APPLY, 0, 0, SendMessage); break; case PSN_SETACTIVE: FORWARD_WM_COMMAND(hDlg, ID_INIT, 0, 0, SendMessage); break; case PSN_RESET: FORWARD_WM_COMMAND(hDlg, IDCANCEL, 0, 0, SendMessage); break; } break; case WM_INITDIALOG: { DWORD dwOptions; dwOptions = ReadVideoOptions(); FillWindowSizeCB(dwOptions, GetDlgItem(hDlg, IDC_VIDEO_CB_SIZE)); SetWindowLongPtr(hDlg, DWLP_USER, (LPARAM)dwOptions); DoMonitorBmp(hDlg); if (IsFlagSet(dwOptions, MCIAVIO_USEVGABYDEFAULT)) { CheckRadioButton(hDlg, IDC_VIDEO_INWINDOW, IDC_VIDEO_FULLSCREEN, IDC_VIDEO_FULLSCREEN); EnableWindow(GetDlgItem(hDlg, IDC_VIDEO_CB_SIZE), FALSE); ShowSampleScreen(hDlg, MCIAVIO_USEVGABYDEFAULT); break; } else { CheckRadioButton(hDlg, IDC_VIDEO_INWINDOW, IDC_VIDEO_FULLSCREEN, IDC_VIDEO_INWINDOW); EnableWindow(GetDlgItem(hDlg, IDC_VIDEO_CB_SIZE), TRUE); } ShowSampleScreen(hDlg, dwOptions & (MCIAVIO_WINDOWSIZEMASK|MCIAVIO_ZOOMBY2)); break; } case WM_DESTROY: if (g_hbmScrSample) { DeleteObject(g_hbmScrSample); g_hbmScrSample = NULL; } if (g_hbmMonitor) { DeleteObject(g_hbmMonitor); g_hbmMonitor = NULL; } if (g_hbmDefault) { DeleteObject(g_hbmDefault); g_hbmDefault = NULL; } if (g_hdcMem) { DeleteDC(g_hdcMem); g_hdcMem = NULL; } break; case WM_DROPFILES: break; case WM_CONTEXTMENU: WinHelp ((HWND) wParam, NULL, HELP_CONTEXTMENU, (UINT_PTR) (LPTSTR) aVideoDlgHelpIds); return TRUE; case WM_HELP: { LPHELPINFO lphi = (LPVOID) lParam; WinHelp (lphi->hItemHandle, NULL, HELP_WM_HELP, (UINT_PTR) (LPTSTR) aVideoDlgHelpIds); return TRUE; } case WM_COMMAND: HANDLE_WM_COMMAND(hDlg, wParam, lParam, DoVideoCommand); break; } return FALSE; } BOOL PASCAL DoVideoCommand(HWND hDlg, int id, HWND hwndCtl, UINT codeNotify) { switch (id) { case ID_APPLY: { int iIndex; HWND hCBWinSize = GetDlgItem(hDlg,IDC_VIDEO_CB_SIZE); DWORD dwOldOpt; DWORD dwNewOpt; dwOldOpt = (DWORD)GetWindowLongPtr(hDlg, DWLP_USER); if(Button_GetCheck(GetDlgItem(hDlg, IDC_VIDEO_FULLSCREEN))) { dwNewOpt = MCIAVIO_USEVGABYDEFAULT; } else { iIndex = ComboBox_GetCurSel(hCBWinSize); dwNewOpt = (DWORD)ComboBox_GetItemData(hCBWinSize, iIndex); } ClearFlag(dwOldOpt,MCIAVIO_WINDOWSIZEMASK|MCIAVIO_USEVGABYDEFAULT|MCIAVIO_ZOOMBY2); SetFlag(dwOldOpt, dwNewOpt); WriteVideoOptions(dwOldOpt); SetWindowLongPtr(hDlg, DWLP_USER, (LPARAM)dwOldOpt); return TRUE; } case IDOK: break; case IDCANCEL: break; case IDC_VIDEO_FULLSCREEN: EnableWindow(GetDlgItem(hDlg, IDC_VIDEO_CB_SIZE), FALSE); PropSheet_Changed(GetParent(hDlg),hDlg); ShowSampleScreen(hDlg, MCIAVIO_USEVGABYDEFAULT); break; case IDC_VIDEO_INWINDOW: { HWND hwndCB = GetDlgItem(hDlg,IDC_VIDEO_CB_SIZE); int iIndex = ComboBox_GetCurSel(hwndCB); int iOpt = (int)ComboBox_GetItemData(hwndCB, iIndex); EnableWindow(GetDlgItem(hDlg, IDC_VIDEO_CB_SIZE), TRUE); PropSheet_Changed(GetParent(hDlg),hDlg); ShowSampleScreen(hDlg, iOpt); break; } case IDC_VIDEO_CB_SIZE: switch (codeNotify) { case CBN_SELCHANGE: { int iIndex = ComboBox_GetCurSel(hwndCtl); int iOpt = (int)ComboBox_GetItemData(hwndCtl, iIndex); PropSheet_Changed(GetParent(hDlg),hDlg); ShowSampleScreen(hDlg, iOpt); break; } default: break; } break; case ID_VIDEO_ADVANCED: { INT_PTR f16BitCompat; f16BitCompat = (GetWindowLongPtr(hDlg, DWLP_USER) & MCIAVIO_F16BITCOMPAT); if (DialogBoxParam (ghInstance, MAKEINTRESOURCE(ADVVIDEODLG), hDlg, AdvancedVideoDlgProc, (LPARAM)&f16BitCompat) == IDOK) { SetWindowLongPtr (hDlg, DWLP_USER, GetWindowLongPtr (hDlg, DWLP_USER) & (~MCIAVIO_F16BITCOMPAT) | ((f16BitCompat) ? (MCIAVIO_F16BITCOMPAT) : 0)); PropSheet_Changed(GetParent(hDlg),hDlg); } break; } case ID_INIT: break; } return FALSE; }