/* This function handles the WM_COMMAND message. */ void FASTCALL RASBlinkProperties_OnCommand( HWND hwnd, int id, HWND hwndCtl, UINT codeNotify ) { switch( id ) { case IDD_USERNAME: case IDD_PASSWORD: if( codeNotify == EN_CHANGE ) PropSheet_Changed( GetParent( hwnd ), hwnd ); break; case IDD_LIST: if( codeNotify == CBN_SELCHANGE ) PropSheet_Changed( GetParent( hwnd ), hwnd ); else if( codeNotify == CBN_DROPDOWN && !fRasFill ) { FillRasConnections( hwnd, IDD_LIST ); fRasFill = TRUE; } break; case IDD_USERAS:{ BOOL fChecked; fChecked = IsDlgButtonChecked( hwnd, IDD_USERAS ); EnableControl( hwnd, IDD_PAD1, fChecked ); EnableControl( hwnd, IDD_PAD2, fChecked ); EnableControl( hwnd, IDD_PAD3, fChecked ); EnableControl( hwnd, IDD_LIST, fChecked ); EnableControl( hwnd, IDD_USERNAME, fChecked ); EnableControl( hwnd, IDD_PASSWORD, fChecked ); PropSheet_Changed( GetParent( hwnd ), hwnd ); break; } } }
void Options_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT /* codeNotify */) { switch (id) { case IDC_AUTOHIDE: // First let the property sheet know somethings changed PropSheet_Changed(GetParent(hwnd), hwnd); // Now update the picture if (Button_GetCheck(hwndCtl)) { ShowWindow(GetDlgItem(hwnd, IDC_APPBAR), SW_HIDE); } else { ShowWindow(GetDlgItem(hwnd, IDC_APPBAR), SW_SHOW); } break; case IDC_ONTOP: // First let the property sheet know somethings changed PropSheet_Changed(GetParent(hwnd), hwnd); // Now update the picture if (Button_GetCheck(hwndCtl)) { ShowWindow(GetDlgItem(hwnd, IDC_WINDOW), SW_HIDE); } else { ShowWindow(GetDlgItem(hwnd, IDC_WINDOW), SW_SHOW); } break; } }
static VOID UpdateRefreshRateSelection(PDESKMONITOR This) { PDEVMODEW lpCurrentDevMode; INT i; if (This->DeskExtInterface != NULL) { i = (INT)SendDlgItemMessage(This->hwndDlg, IDC_REFRESHRATE, CB_GETCURSEL, 0, 0); if (i >= 0) { lpCurrentDevMode = This->lpSelDevMode; This->lpSelDevMode = (PDEVMODEW)SendDlgItemMessage(This->hwndDlg, IDC_REFRESHRATE, CB_GETITEMDATA, (WPARAM)i, 0); if (This->lpSelDevMode != NULL && This->lpSelDevMode != lpCurrentDevMode) { This->DeskExtInterface->SetCurrentMode(This->DeskExtInterface->Context, This->lpSelDevMode); UpdateRefreshFrequencyList(This); (void)PropSheet_Changed(GetParent(This->hwndDlg), This->hwndDlg); } } } }
/* Property page dialog callback */ INT_PTR CALLBACK HibernateDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: Hib_InitDialog(hwndDlg); return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_HIBERNATEFILE: if (HIWORD(wParam) == BN_CLICKED) { PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } } break; case WM_NOTIFY: { LPNMHDR lpnm = (LPNMHDR)lParam; if (lpnm->code == (UINT)PSN_APPLY) { return Hib_SaveData(hwndDlg); } } } return FALSE; }
void LptPortOnCommand( HWND ParentHwnd, int ControlId, HWND ControlHwnd, UINT NotifyCode ) { UNREFERENCED_PARAMETER(ControlHwnd); if (NotifyCode == CBN_SELCHANGE) { PropSheet_Changed(GetParent(ParentHwnd), ParentHwnd); } else { switch (ControlId) { // // Because this is a prop sheet, we should never get this. // All notifications for ctrols outside of the sheet come through // WM_NOTIFY // case IDOK: case IDCANCEL: EndDialog(ParentHwnd, 0); return; } } } // LptPortOnCommand
DWORD VerifyUnattendLCID(HWND hwndDlg) { LRESULT lCount, lIndex, lResult; lCount = SendMessage(hList, CB_GETCOUNT, (WPARAM)0, (LPARAM)0); if (lCount == CB_ERR) { return 0; } for (lIndex = 0; lIndex < lCount; lIndex++) { lResult = SendMessage(hList, CB_GETITEMDATA, (WPARAM)lIndex, (LPARAM)0); if (lResult == CB_ERR) { continue; } if (lResult == (LRESULT)UnattendLCID) { SendMessage(hList, CB_SETCURSEL, (WPARAM)lIndex, (LPARAM)0); PropSheet_Changed(GetParent(hwndDlg), hwndDlg); return 1; } } return 0; }
//---------------------------------------------------------------------------------------------- // ApplyChangedSetting //---------------------------------------------------------------------------------------------- VOID CControllerPage::ApplyChangedSetting() { // 変数宣言 HWND Dialog = GetParent( Wnd ); // 設定を反映する ApplySetting(); // 各ページに設定を反映する for( LONG Index = 1; Index < 7; Index ++ ) { HWND Page = PropSheet_IndexToHwnd( Dialog, Index ); if( Page != NULL ) { SendMessage( Page ,WM_SETTING_LIST_CHANGED ,NULL ,NULL ); } } // プロパティ シートに変更を通知する PropSheet_Changed( Dialog, Wnd ); }
static VOID ListViewItemChanged(HWND hwndDlg, PDATA pData, int itemIndex) { BackgroundItem *backgroundItem = NULL; pData->backgroundSelection = itemIndex; backgroundItem = &pData->backgroundItems[pData->backgroundSelection]; if (pData->pWallpaperBitmap != NULL) { DibFreeImage(pData->pWallpaperBitmap); pData->pWallpaperBitmap = NULL; } if (backgroundItem->bWallpaper == TRUE) { pData->pWallpaperBitmap = DibLoadImage(backgroundItem->szFilename); if (pData->pWallpaperBitmap == NULL) return; } pData->bWallpaperChanged = TRUE; InvalidateRect(GetDlgItem(hwndDlg, IDC_BACKGROUND_PREVIEW), NULL, TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_PLACEMENT_COMBO), backgroundItem->bWallpaper); PropSheet_Changed(GetParent(hwndDlg), hwndDlg); }
static VOID UpdatePruningSelection(PDESKMONITOR This) { BOOL bPruningOn; if (This->DeskExtInterface != NULL && This->bModesPruned && !This->bKeyIsReadOnly) { bPruningOn = IsDlgButtonChecked(This->hwndDlg, IDC_PRUNINGCHECK) != BST_UNCHECKED; if (bPruningOn != This->bPruningOn) { /* Tell desk.cpl to turn on/off pruning mode */ This->bPruningOn = bPruningOn; This->DeskExtInterface->SetPruningMode(This->DeskExtInterface->Context, bPruningOn); /* Fill the refresh rate combobox again, we now receive a filtered or unfiltered device mode list from desk.cpl (depending on whether pruning is active or not) */ UpdateRefreshFrequencyList(This); (void)PropSheet_Changed(GetParent(This->hwndDlg), This->hwndDlg); } } }
static VOID OnColorButton(HWND hwndDlg, PDATA pData) { /* Load custom colors from Registry */ HKEY hKey = NULL; LONG res = ERROR_SUCCESS; CHOOSECOLOR cc; res = RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Appearance"), 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, NULL); /* Now the key is either created or opened existing, if res == ERROR_SUCCESS */ if (res == ERROR_SUCCESS) { /* Key opened */ DWORD dwType = REG_BINARY; DWORD cbData = sizeof(pData->custom_colors); res = RegQueryValueEx(hKey, TEXT("CustomColors"), NULL, &dwType, (LPBYTE)pData->custom_colors, &cbData); RegCloseKey(hKey); hKey = NULL; } /* Launch ChooseColor() dialog */ cc.lStructSize = sizeof(CHOOSECOLOR); cc.hwndOwner = hwndDlg; cc.hInstance = NULL; cc.rgbResult = g_GlobalData.desktop_color; cc.lpCustColors = pData->custom_colors; cc.Flags = CC_ANYCOLOR | /* Causes the dialog box to display all available colors in the set of basic colors. */ CC_FULLOPEN | /* opens dialog in full size */ CC_RGBINIT ; /* init chosen color by rgbResult value */ cc.lCustData = 0; cc.lpfnHook = NULL; cc.lpTemplateName = NULL; if (ChooseColor(&cc)) { /* Save selected color to var */ g_GlobalData.desktop_color = cc.rgbResult; pData->bClrBackgroundChanged = TRUE; /* Apply button will be activated */ PropSheet_Changed(GetParent(hwndDlg), hwndDlg); /* Window will be updated :) */ InvalidateRect(GetDlgItem(hwndDlg, IDC_BACKGROUND_PREVIEW), NULL, TRUE); /* Save custom colors to reg. To this moment key must be created already. See above */ res = RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Appearance"), 0, KEY_WRITE, &hKey); if (res == ERROR_SUCCESS) { /* Key opened */ RegSetValueEx(hKey, TEXT("CustomColors"), 0, REG_BINARY, (const BYTE *)pData->custom_colors, sizeof(pData->custom_colors)); RegCloseKey(hKey); hKey = NULL; } } }
void CDialogTrustDB::NotifySheetOfChange() // // Inform our sheet that something on this page has changed // { HWND hwndSheet = ::GetParent(GetWindow()); PropSheet_Changed(hwndSheet, GetWindow()); }
/* Property page dialog callback */ INT_PTR CALLBACK AdvancedDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: hAdv = hwndDlg; Adv_InitDialog(); return TRUE; break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_SYSTRAYBATTERYMETER: case IDC_PASSWORDLOGON: case IDC_VIDEODIMDISPLAY: if (HIWORD(wParam) == BN_CLICKED) { PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } break; case IDC_LIDCLOSE: case IDC_POWERBUTTON: case IDC_SLEEPBUTTON: if (HIWORD(wParam) == CBN_SELCHANGE) { PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } break; } break; case WM_NOTIFY: { LPNMHDR lpnm = (LPNMHDR)lParam; if (lpnm->code == (UINT)PSN_APPLY) { Adv_SaveData(hwndDlg); } return TRUE; } } return FALSE; }
void Port_OnRestorePortClicked( HWND DialogHwnd, PPORT_PARAMS Params ) { RestorePortSettings(DialogHwnd, Params); PropSheet_Changed(GetParent(DialogHwnd), DialogHwnd); }
INT_PTR CALLBACK AdvGeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { PDISPLAY_DEVICE_ENTRY DispDevice = NULL; INT_PTR Ret = 0; if (uMsg != WM_INITDIALOG) DispDevice = (PDISPLAY_DEVICE_ENTRY)GetWindowLongPtr(hwndDlg, DWLP_USER); switch (uMsg) { case WM_INITDIALOG: DispDevice = (PDISPLAY_DEVICE_ENTRY)(((LPPROPSHEETPAGE)lParam)->lParam); SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)DispDevice); InitFontSizeList(hwndDlg); InitRadioButtons(hwndDlg); Ret = TRUE; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_FONTSIZE_COMBO: if (HIWORD(wParam) == CBN_SELCHANGE) { PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } break; case IDC_RESTART_RB: case IDC_WITHOUTREBOOT_RB: case IDC_ASKME_RB: PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } break; } return Ret; }
void OptionsPageMore::updateHasChanged() { if (m_oldSettings == m_newSettings) { PropSheet_UnChanged(GetParent(m_hwnd), m_hwnd); } else { PropSheet_Changed(GetParent(m_hwnd), m_hwnd); } }
static void CheckEnableApply() { BOOL bEnable = FALSE; bEnable = (bFsRunning != bFsOn) || (bDbRunning != bDbOn) || (bBakRunning != bBakOn) || (bScsRunning != bScsOn) || (bSccRunning != bSccOn); if (bEnable) PropSheet_Changed(GetParent(hDlg), hDlg); else PropSheet_UnChanged(GetParent(hDlg), hDlg); }
static INT_PTR CALLBACK AdvancedSettingsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: CheckDlgButton(hwndDlg, IDC_TASKBARPROP_SECONDS, AdvancedSettings.bShowSeconds ? BST_CHECKED : BST_UNCHECKED); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_TASKBARPROP_SECONDS: if (HIWORD(wParam) == BN_CLICKED) { PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } break; } break; case WM_NOTIFY: { LPNMHDR pnmh = (LPNMHDR)lParam; switch (pnmh->code) { case PSN_SETACTIVE: break; case PSN_APPLY: AdvancedSettings.bShowSeconds = IsDlgButtonChecked(hwndDlg, IDC_TASKBARPROP_SECONDS); SaveSettingDword(szAdvancedSettingsKey, TEXT("ShowSeconds"), AdvancedSettings.bShowSeconds); break; } break; } case WM_DESTROY: break; default: return FALSE; } return FALSE; }
int DesktopSettingsDlg::Command(int id, int code) { switch(id) { case ID_DESKTOP_VERSION: SendMessage(g_Globals._hwndShellView, PM_DISPLAY_VERSION, 0, MAKELONG(0,1)); // toggle version display flag PropSheet_Changed(GetParent(_hwnd), _hwnd); break; default: return 1; } return 0; }
static void ViewDlg_OnTreeViewKeyDown(HWND hwndDlg, TV_KEYDOWN *KeyDown) { HWND hwndTreeView = GetDlgItem(hwndDlg, IDC_VIEW_TREEVIEW); if (KeyDown->wVKey == VK_SPACE) { // [Space] key was pressed HTREEITEM hItem = TreeView_GetSelection(hwndTreeView); if (ViewDlg_ToggleCheckItem(hwndDlg, hItem)) { PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } } }
INT_PTR SettingsTab::DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: _dlgHwnd = hwndDlg; Initialize(); LoadSettings(); return FALSE; case WM_COMMAND: PropSheet_Changed(GetParent(hwndDlg), NULL); break; } return Dialog::DialogProc(hwndDlg, uMsg, wParam, lParam); }
LRESULT CALLBACK ComboDlgProc( HWND hdlg, UINT uMessage, WPARAM wParam, LPARAM lParam) { LPNMHDR lpnmhdr; switch (uMessage) { // on any command notification, tell the property sheet to enable the Apply button case WM_COMMAND: PropSheet_Changed(GetParent(hdlg), hdlg); break; case WM_NOTIFY: lpnmhdr = (NMHDR FAR *)lParam; switch (lpnmhdr->code) { case PSN_APPLY: //sent when OK or Apply button pressed break; case PSN_RESET: //sent when Cancel button pressed break; case PSN_SETACTIVE: //this will be ignored if the property sheet is not a wizard PropSheet_SetWizButtons(GetParent(hdlg), PSWIZB_BACK | PSWIZB_FINISH); return FALSE; default: break; } break; default: break; } return FALSE; }
static VOID ViewDlg_OnTreeViewClick(HWND hwndDlg) { HWND hwndTreeView = GetDlgItem(hwndDlg, IDC_VIEW_TREEVIEW); // do hit test to get the clicked item TV_HITTESTINFO HitTest; ZeroMemory(&HitTest, sizeof(HitTest)); DWORD dwPos = GetMessagePos(); HitTest.pt.x = LOWORD(dwPos); HitTest.pt.y = HIWORD(dwPos); ScreenToClient(hwndTreeView, &HitTest.pt); HTREEITEM hItem = TreeView_HitTest(hwndTreeView, &HitTest); // toggle the check mark if possible if (ViewDlg_ToggleCheckItem(hwndDlg, hItem)) { // property sheet was changed PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } }
static VOID ShowListAllModes(PDESKDISPLAYADAPTER This) { PDEVMODEW lpPrevSel; lpPrevSel = This->lpSelDevMode; if (This->DeskExtInterface != NULL && DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_LISTALLMODES), This->hwndDlg, ListAllModesDlgProc, (LPARAM)This) == IDOK) { if (lpPrevSel != This->lpSelDevMode) { (void)PropSheet_Changed(GetParent(This->hwndDlg), This->hwndDlg); This->DeskExtInterface->SetCurrentMode(This->DeskExtInterface->Context, This->lpSelDevMode); } } }
void CWatermarkDlg::OnWatermarkTypeChanged(UINT uNotifyCode, int nID, CWindow wndCtl) { if (uNotifyCode == CBN_SELCHANGE && m_wndWatermark.m_hWnd == wndCtl.m_hWnd) { BOOL enableWatermark = m_wndWatermark.GetCurSel() != 0; BOOL enableTextWatermark = m_wndWatermark.GetCurSel() == 2; ::EnableWindow(GetDlgItem(IDC_BROWSER), enableWatermark && !enableTextWatermark); ::EnableWindow(GetDlgItem(IDC_FILE), enableWatermark && !enableTextWatermark); ::EnableWindow(GetDlgItem(IDC_WATERMARK_TEXT), enableWatermark && enableTextWatermark); ::EnableWindow(GetDlgItem(IDC_FONT_TYPE), enableWatermark && enableTextWatermark); ::EnableWindow(GetDlgItem(IDC_FONT_STYLE), enableWatermark && enableTextWatermark); ::EnableWindow(GetDlgItem(IDC_FONT_SIZE), enableWatermark && enableTextWatermark); ::EnableWindow(GetDlgItem(IDC_ANGLE_SLIDER), enableWatermark && enableTextWatermark); ::EnableWindow(GetDlgItem(IDC_WATERMARK_SIZE_SLIDER), enableWatermark); ::EnableWindow(GetDlgItem(IDC_BRIGHTNESS_SLIDER), enableWatermark); ::EnableWindow(GetDlgItem(IDC_PIINT_POSITION), enableWatermark); PropSheet_Changed(GetParent(), m_hWnd); } }
static VOID ViewDlg_RestoreDefaults(HWND hwndDlg) { HWND hwndTreeView = GetDlgItem(hwndDlg, IDC_VIEW_TREEVIEW); for (INT i = 0; i < s_ViewTreeEntryCount; ++i) { // ignore if the type is group VIEWTREE_ENTRY *pEntry = &s_ViewTreeEntries[i]; if (pEntry->dwType == AETYPE_GROUP) continue; // set default value on registry HKEY hKey; if (RegOpenKeyExW(HKEY(pEntry->hkeyRoot), pEntry->szRegPath, 0, KEY_WRITE, &hKey) != ERROR_SUCCESS) { continue; } RegSetValueExW(hKey, pEntry->szValueName, 0, REG_DWORD, LPBYTE(&pEntry->dwDefaultValue), sizeof(DWORD)); RegCloseKey(hKey); // update check status pEntry->bChecked = (pEntry->dwCheckedValue == pEntry->dwDefaultValue); // update the image TV_ITEM Item; ZeroMemory(&Item, sizeof(Item)); Item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; Item.hItem = pEntry->hItem; Item.iImage = Item.iSelectedImage = ViewTree_GetImage(pEntry); TreeView_SetItem(hwndTreeView, &Item); } PropSheet_Changed(GetParent(hwndDlg), hwndDlg); }
void Port_OnCommand( HWND DialogHwnd, int ControlId, HWND ControlHwnd, UINT NotifyCode ) { PPORT_PARAMS params = (PPORT_PARAMS)GetWindowLongPtr(DialogHwnd, DWLP_USER); UNREFERENCED_PARAMETER(ControlHwnd); if (NotifyCode == CBN_SELCHANGE) { PropSheet_Changed(GetParent(DialogHwnd), DialogHwnd); } else { switch (ControlId) { case IDC_ADVANCED: Port_OnAdvancedClicked(DialogHwnd, params); break; case IDC_RESTORE_PORT: Port_OnRestorePortClicked(DialogHwnd, params); break; // // Because this is a prop sheet, we should never get this. // All notifications for ctrols outside of the sheet come through // WM_NOTIFY // case IDCANCEL: EndDialog(DialogHwnd, 0); return; } } }
INT_PTR CALLBACK LayoutProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: { /* Multi-monitor support */ LONG xVirtScr, yVirtScr; // Coordinates of the top-left virtual screen LONG cxVirtScr, cyVirtScr; // Width and Height of the virtual screen LONG cxFrame , cyFrame ; // Thickness of the window frame xVirtScr = GetSystemMetrics(SM_XVIRTUALSCREEN); yVirtScr = GetSystemMetrics(SM_YVIRTUALSCREEN); cxVirtScr = GetSystemMetrics(SM_CXVIRTUALSCREEN); cyVirtScr = GetSystemMetrics(SM_CYVIRTUALSCREEN); cxFrame = GetSystemMetrics(SM_CXFRAME); cyFrame = GetSystemMetrics(SM_CYFRAME); SendDlgItemMessageW(hDlg, IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1)); SendDlgItemMessageW(hDlg, IDC_UPDOWN_SCREEN_BUFFER_WIDTH , UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1)); SendDlgItemMessageW(hDlg, IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1)); SendDlgItemMessageW(hDlg, IDC_UPDOWN_WINDOW_SIZE_WIDTH , UDM_SETRANGE, 0, (LPARAM)MAKELONG(9999, 1)); SetDlgItemInt(hDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, ConInfo->ScreenBufferSize.Y, FALSE); SetDlgItemInt(hDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH , ConInfo->ScreenBufferSize.X, FALSE); SetDlgItemInt(hDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, ConInfo->WindowSize.Y, FALSE); SetDlgItemInt(hDlg, IDC_EDIT_WINDOW_SIZE_WIDTH , ConInfo->WindowSize.X, FALSE); SendDlgItemMessageW(hDlg, IDC_UPDOWN_WINDOW_POS_LEFT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(xVirtScr + cxVirtScr - cxFrame, xVirtScr - cxFrame)); SendDlgItemMessageW(hDlg, IDC_UPDOWN_WINDOW_POS_TOP , UDM_SETRANGE, 0, (LPARAM)MAKELONG(yVirtScr + cyVirtScr - cyFrame, yVirtScr - cyFrame)); SetDlgItemInt(hDlg, IDC_EDIT_WINDOW_POS_LEFT, ConInfo->WindowPosition.x, TRUE); SetDlgItemInt(hDlg, IDC_EDIT_WINDOW_POS_TOP , ConInfo->WindowPosition.y, TRUE); if (ConInfo->AutoPosition) { EnableDlgItem(hDlg, IDC_EDIT_WINDOW_POS_LEFT, FALSE); EnableDlgItem(hDlg, IDC_EDIT_WINDOW_POS_TOP , FALSE); EnableDlgItem(hDlg, IDC_UPDOWN_WINDOW_POS_LEFT, FALSE); EnableDlgItem(hDlg, IDC_UPDOWN_WINDOW_POS_TOP , FALSE); } CheckDlgButton(hDlg, IDC_CHECK_SYSTEM_POS_WINDOW, ConInfo->AutoPosition ? BST_CHECKED : BST_UNCHECKED); return TRUE; } case WM_DISPLAYCHANGE: { /* Retransmit to the preview window */ SendDlgItemMessageW(hDlg, IDC_STATIC_LAYOUT_WINDOW_PREVIEW, WM_DISPLAYCHANGE, wParam, lParam); break; } case WM_NOTIFY: { LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam; if (lppsn->hdr.code == UDN_DELTAPOS) { LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam; DWORD wheight, wwidth; DWORD sheight, swidth; DWORD left, top; if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_WIDTH) { wwidth = lpnmud->iPos + lpnmud->iDelta; } else { wwidth = GetDlgItemInt(hDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, NULL, FALSE); } if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_HEIGHT) { wheight = lpnmud->iPos + lpnmud->iDelta; } else { wheight = GetDlgItemInt(hDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, NULL, FALSE); } if (lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_WIDTH) { swidth = lpnmud->iPos + lpnmud->iDelta; } else { swidth = GetDlgItemInt(hDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, NULL, FALSE); } if (lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_HEIGHT) { sheight = lpnmud->iPos + lpnmud->iDelta; } else { sheight = GetDlgItemInt(hDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, NULL, FALSE); } if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_POS_LEFT) { left = lpnmud->iPos + lpnmud->iDelta; } else { left = GetDlgItemInt(hDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, TRUE); } if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_POS_TOP) { top = lpnmud->iPos + lpnmud->iDelta; } else { top = GetDlgItemInt(hDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, TRUE); } if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_WIDTH || lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_SIZE_HEIGHT) { /* Automatically adjust screen buffer size when window size enlarges */ if (wwidth >= swidth) { SetDlgItemInt(hDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, wwidth, TRUE); swidth = wwidth; } if (wheight >= sheight) { SetDlgItemInt(hDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, wheight, TRUE); sheight = wheight; } } /* Be sure that the (new) screen buffer sizes are in the correct range */ swidth = min(max(swidth , 1), 0xFFFF); sheight = min(max(sheight, 1), 0xFFFF); if (lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_WIDTH || lppsn->hdr.idFrom == IDC_UPDOWN_SCREEN_BUFFER_HEIGHT) { /* Automatically adjust window size when screen buffer decreases */ if (wwidth > swidth) { SetDlgItemInt(hDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, swidth, TRUE); wwidth = swidth; } if (wheight > sheight) { SetDlgItemInt(hDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, sheight, TRUE); wheight = sheight; } } ConInfo->ScreenBufferSize.X = (SHORT)swidth; ConInfo->ScreenBufferSize.Y = (SHORT)sheight; ConInfo->WindowSize.X = (SHORT)wwidth; ConInfo->WindowSize.Y = (SHORT)wheight; ConInfo->WindowPosition.x = left; ConInfo->WindowPosition.y = top; InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_LAYOUT_WINDOW_PREVIEW), NULL, TRUE); PropSheet_Changed(GetParent(hDlg), hDlg); } break; } case WM_COMMAND: { if (HIWORD(wParam) == EN_KILLFOCUS) { switch (LOWORD(wParam)) { case IDC_EDIT_SCREEN_BUFFER_WIDTH: { DWORD swidth, wwidth; swidth = GetDlgItemInt(hDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, NULL, FALSE); wwidth = GetDlgItemInt(hDlg, IDC_EDIT_WINDOW_SIZE_WIDTH , NULL, FALSE); /* Be sure that the (new) screen buffer width is in the correct range */ swidth = min(max(swidth, 1), 0xFFFF); /* Automatically adjust window size when screen buffer decreases */ if (wwidth > swidth) { wwidth = swidth; SetDlgItemInt(hDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, wwidth, TRUE); } ConInfo->ScreenBufferSize.X = (SHORT)swidth; ConInfo->WindowSize.X = (SHORT)wwidth; InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_LAYOUT_WINDOW_PREVIEW), NULL, TRUE); PropSheet_Changed(GetParent(hDlg), hDlg); break; } case IDC_EDIT_WINDOW_SIZE_WIDTH: { DWORD swidth, wwidth; swidth = GetDlgItemInt(hDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, NULL, FALSE); wwidth = GetDlgItemInt(hDlg, IDC_EDIT_WINDOW_SIZE_WIDTH , NULL, FALSE); /* Automatically adjust screen buffer size when window size enlarges */ if (wwidth >= swidth) { swidth = wwidth; /* Be sure that the (new) screen buffer width is in the correct range */ swidth = min(max(swidth, 1), 0xFFFF); SetDlgItemInt(hDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, swidth, TRUE); } ConInfo->ScreenBufferSize.X = (SHORT)swidth; ConInfo->WindowSize.X = (SHORT)wwidth; InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_LAYOUT_WINDOW_PREVIEW), NULL, TRUE); PropSheet_Changed(GetParent(hDlg), hDlg); break; } case IDC_EDIT_SCREEN_BUFFER_HEIGHT: { DWORD sheight, wheight; sheight = GetDlgItemInt(hDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, NULL, FALSE); wheight = GetDlgItemInt(hDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT , NULL, FALSE); /* Be sure that the (new) screen buffer width is in the correct range */ sheight = min(max(sheight, 1), 0xFFFF); /* Automatically adjust window size when screen buffer decreases */ if (wheight > sheight) { wheight = sheight; SetDlgItemInt(hDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, wheight, TRUE); } ConInfo->ScreenBufferSize.Y = (SHORT)sheight; ConInfo->WindowSize.Y = (SHORT)wheight; InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_LAYOUT_WINDOW_PREVIEW), NULL, TRUE); PropSheet_Changed(GetParent(hDlg), hDlg); break; } case IDC_EDIT_WINDOW_SIZE_HEIGHT: { DWORD sheight, wheight; sheight = GetDlgItemInt(hDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, NULL, FALSE); wheight = GetDlgItemInt(hDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT , NULL, FALSE); /* Automatically adjust screen buffer size when window size enlarges */ if (wheight >= sheight) { sheight = wheight; /* Be sure that the (new) screen buffer width is in the correct range */ sheight = min(max(sheight, 1), 0xFFFF); SetDlgItemInt(hDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, sheight, TRUE); } ConInfo->ScreenBufferSize.Y = (SHORT)sheight; ConInfo->WindowSize.Y = (SHORT)wheight; InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_LAYOUT_WINDOW_PREVIEW), NULL, TRUE); PropSheet_Changed(GetParent(hDlg), hDlg); break; } case IDC_EDIT_WINDOW_POS_LEFT: case IDC_EDIT_WINDOW_POS_TOP: { ConInfo->WindowPosition.x = GetDlgItemInt(hDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, TRUE); ConInfo->WindowPosition.y = GetDlgItemInt(hDlg, IDC_EDIT_WINDOW_POS_TOP , NULL, TRUE); InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_LAYOUT_WINDOW_PREVIEW), NULL, TRUE); PropSheet_Changed(GetParent(hDlg), hDlg); break; } } } else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_CHECK_SYSTEM_POS_WINDOW) { if (IsDlgButtonChecked(hDlg, IDC_CHECK_SYSTEM_POS_WINDOW) == BST_CHECKED) { EnableDlgItem(hDlg, IDC_EDIT_WINDOW_POS_LEFT, FALSE); EnableDlgItem(hDlg, IDC_EDIT_WINDOW_POS_TOP , FALSE); EnableDlgItem(hDlg, IDC_UPDOWN_WINDOW_POS_LEFT, FALSE); EnableDlgItem(hDlg, IDC_UPDOWN_WINDOW_POS_TOP , FALSE); ConInfo->AutoPosition = TRUE; // Do not touch ConInfo->WindowPosition !! InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_LAYOUT_WINDOW_PREVIEW), NULL, TRUE); PropSheet_Changed(GetParent(hDlg), hDlg); } else { ULONG left, top; left = GetDlgItemInt(hDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, TRUE); top = GetDlgItemInt(hDlg, IDC_EDIT_WINDOW_POS_TOP , NULL, TRUE); EnableDlgItem(hDlg, IDC_EDIT_WINDOW_POS_LEFT, TRUE); EnableDlgItem(hDlg, IDC_EDIT_WINDOW_POS_TOP , TRUE); EnableDlgItem(hDlg, IDC_UPDOWN_WINDOW_POS_LEFT, TRUE); EnableDlgItem(hDlg, IDC_UPDOWN_WINDOW_POS_TOP , TRUE); ConInfo->AutoPosition = FALSE; ConInfo->WindowPosition.x = left; ConInfo->WindowPosition.y = top; InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_LAYOUT_WINDOW_PREVIEW), NULL, TRUE); PropSheet_Changed(GetParent(hDlg), hDlg); } } break; } default: break; } return FALSE; }
INT_PTR CALLBACK ColorsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { PCONSOLE_PROPS pConInfo; DWORD colorIndex; COLORREF color; pConInfo = (PCONSOLE_PROPS)GetWindowLongPtr(hwndDlg, DWLP_USER); switch (uMsg) { case WM_INITDIALOG: { pConInfo = (PCONSOLE_PROPS)((LPPROPSHEETPAGE)lParam)->lParam; SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo); /* Set the valid range of the colour indicators */ SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_COLOR_RED , UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0)); SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_COLOR_GREEN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0)); SendDlgItemMessageW(hwndDlg, IDC_UPDOWN_COLOR_BLUE , UDM_SETRANGE, 0, (LPARAM)MAKELONG(255, 0)); /* Select by default the screen background option */ CheckRadioButton(hwndDlg, IDC_RADIO_SCREEN_TEXT, IDC_RADIO_POPUP_BACKGROUND, IDC_RADIO_SCREEN_BACKGROUND); SendMessage(hwndDlg, WM_COMMAND, IDC_RADIO_SCREEN_BACKGROUND, 0); return TRUE; } case WM_DRAWITEM: { LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam; if (drawItem->CtlID >= IDC_STATIC_COLOR1 && drawItem->CtlID <= IDC_STATIC_COLOR16) return PaintStaticControls(hwndDlg, pConInfo, drawItem); else if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR) return PaintText(drawItem, pConInfo, Screen); else if (drawItem->CtlID == IDC_STATIC_POPUP_COLOR) return PaintText(drawItem, pConInfo, Popup); break; } case WM_NOTIFY: { switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: { if (!pConInfo->AppliedConfig) { return ApplyConsoleInfo(hwndDlg, pConInfo); } else { /* Options have already been applied */ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR); return TRUE; } break; } case UDN_DELTAPOS: { LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam; /* Get the current color */ colorIndex = pConInfo->ActiveStaticControl; color = pConInfo->ci.Colors[colorIndex]; if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_RED) { lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255); color = RGB(lpnmud->iPos, GetGValue(color), GetBValue(color)); } else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_GREEN) { lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255); color = RGB(GetRValue(color), lpnmud->iPos, GetBValue(color)); } else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_BLUE) { lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255); color = RGB(GetRValue(color), GetGValue(color), lpnmud->iPos); } else { break; } pConInfo->ci.Colors[colorIndex] = color; InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE); PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } } break; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDC_RADIO_SCREEN_TEXT: { /* Get the color of the screen foreground */ colorIndex = TextAttribFromAttrib(pConInfo->ci.ScreenAttrib); color = pConInfo->ci.Colors[colorIndex]; /* Set the values of the colour indicators */ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE); SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE); SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); pConInfo->ActiveStaticControl = colorIndex; InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE); break; } case IDC_RADIO_SCREEN_BACKGROUND: { /* Get the color of the screen background */ colorIndex = BkgdAttribFromAttrib(pConInfo->ci.ScreenAttrib); color = pConInfo->ci.Colors[colorIndex]; /* Set the values of the colour indicators */ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE); SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE); SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); pConInfo->ActiveStaticControl = colorIndex; InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE); break; } case IDC_RADIO_POPUP_TEXT: { /* Get the color of the popup foreground */ colorIndex = TextAttribFromAttrib(pConInfo->ci.PopupAttrib); color = pConInfo->ci.Colors[colorIndex]; /* Set the values of the colour indicators */ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE); SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE); SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); pConInfo->ActiveStaticControl = colorIndex; InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE); break; } case IDC_RADIO_POPUP_BACKGROUND: { /* Get the color of the popup background */ colorIndex = BkgdAttribFromAttrib(pConInfo->ci.PopupAttrib); color = pConInfo->ci.Colors[colorIndex]; /* Set the values of the colour indicators */ SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE); SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE); SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); pConInfo->ActiveStaticControl = colorIndex; InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE); break; } case IDC_EDIT_COLOR_RED: { if (HIWORD(wParam) == EN_KILLFOCUS) { DWORD red; /* Get the current color */ colorIndex = pConInfo->ActiveStaticControl; color = pConInfo->ci.Colors[colorIndex]; red = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED, NULL, FALSE); red = min(max(red, 0), 255); color = RGB(red, GetGValue(color), GetBValue(color)); pConInfo->ci.Colors[colorIndex] = color; InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE); PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } break; } case IDC_EDIT_COLOR_GREEN: { if (HIWORD(wParam) == EN_KILLFOCUS) { DWORD green; /* Get the current color */ colorIndex = pConInfo->ActiveStaticControl; color = pConInfo->ci.Colors[colorIndex]; green = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, NULL, FALSE); green = min(max(green, 0), 255); color = RGB(GetRValue(color), green, GetBValue(color)); pConInfo->ci.Colors[colorIndex] = color; InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE); PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } break; } case IDC_EDIT_COLOR_BLUE: { if (HIWORD(wParam) == EN_KILLFOCUS) { DWORD blue; /* Get the current color */ colorIndex = pConInfo->ActiveStaticControl; color = pConInfo->ci.Colors[colorIndex]; blue = GetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE, NULL, FALSE); blue = min(max(blue, 0), 255); color = RGB(GetRValue(color), GetGValue(color), blue); pConInfo->ci.Colors[colorIndex] = color; InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE); PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } break; } } if ( HIWORD(wParam) == STN_CLICKED && IDC_STATIC_COLOR1 <= LOWORD(wParam) && LOWORD(wParam) <= IDC_STATIC_COLOR16 ) { colorIndex = LOWORD(wParam) - IDC_STATIC_COLOR1; if (colorIndex == pConInfo->ActiveStaticControl) { /* Same static control was re-clicked */ break; } color = pConInfo->ci.Colors[colorIndex]; SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_RED , GetRValue(color), FALSE); SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_GREEN, GetGValue(color), FALSE); SetDlgItemInt(hwndDlg, IDC_EDIT_COLOR_BLUE , GetBValue(color), FALSE); /* Update global struct */ if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_SCREEN_TEXT)) { pConInfo->ci.ScreenAttrib = MakeAttrib(colorIndex, BkgdAttribFromAttrib(pConInfo->ci.ScreenAttrib)); } else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_SCREEN_BACKGROUND)) { pConInfo->ci.ScreenAttrib = MakeAttrib(TextAttribFromAttrib(pConInfo->ci.ScreenAttrib), colorIndex); } else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_POPUP_TEXT)) { pConInfo->ci.PopupAttrib = MakeAttrib(colorIndex, BkgdAttribFromAttrib(pConInfo->ci.PopupAttrib)); } else if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_POPUP_BACKGROUND)) { pConInfo->ci.PopupAttrib = MakeAttrib(TextAttribFromAttrib(pConInfo->ci.PopupAttrib), colorIndex); } InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); pConInfo->ActiveStaticControl = colorIndex; InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_COLOR1 + pConInfo->ActiveStaticControl), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR) , NULL, TRUE); PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } } default: break; } return FALSE; }
INT_PTR CALLBACK ScreenSaverPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { PDATA pData; pData = (PDATA)GetWindowLongPtr(hwndDlg, DWLP_USER); switch (uMsg) { case WM_INITDIALOG: { OnInitDialog(hwndDlg, pData); break; } case WM_DESTROY: { if (pData->PrevWindowPi.hProcess) { TerminateProcess(pData->PrevWindowPi.hProcess, 0); CloseHandle(pData->PrevWindowPi.hProcess); CloseHandle(pData->PrevWindowPi.hThread); } HeapFree(GetProcessHeap(), 0, pData); break; } case WM_ENDSESSION: { SetScreenSaverPreviewBox(hwndDlg, pData); break; } case WM_COMMAND: { DWORD controlId = LOWORD(wParam); DWORD command = HIWORD(wParam); switch (controlId) { case IDC_SCREENS_LIST: { if (HIWORD(wParam) == CBN_SELCHANGE) { SelectionChanged(hwndDlg, pData); SetScreenSaverPreviewBox(hwndDlg, pData); PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } break; } case IDC_SCREENS_TIMEDELAY: { PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } case IDC_SCREENS_POWER_BUTTON: // Start Powercfg.Cpl { if (command == BN_CLICKED) WinExec("rundll32 shell32.dll,Control_RunDLL powercfg.cpl",SW_SHOWNORMAL); break; } case IDC_SCREENS_TESTSC: // Screensaver Preview { if (command == BN_CLICKED) { ScreensaverPreview(hwndDlg, pData); SetScreenSaverPreviewBox(hwndDlg, pData); } break; } case IDC_SCREENS_SETTINGS: // Screensaver Settings { if (command == BN_CLICKED) ScreensaverConfig(hwndDlg, pData); break; } case IDC_SCREENS_USEPASSCHK: // Screensaver Is Secure { if (command == BN_CLICKED) { PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } break; } } break; } case WM_NOTIFY: { LPNMHDR lpnm = (LPNMHDR)lParam; switch(lpnm->code) { case PSN_APPLY: { SetScreenSaver(hwndDlg, pData); return TRUE; } case PSN_SETACTIVE: { /* Enable screensaver preview support */ SetScreenSaverPreviewBox(hwndDlg, pData); break; } case PSN_KILLACTIVE: { /* Kill running preview screensaver */ if (pData->PrevWindowPi.hProcess) { TerminateProcess(pData->PrevWindowPi.hProcess, 0); CloseHandle(pData->PrevWindowPi.hProcess); CloseHandle(pData->PrevWindowPi.hThread); pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL; } break; } } } break; } return FALSE; }
/* Property page dialog callback */ INT_PTR CALLBACK MousePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { PGLOBAL_DATA pGlobalData; LPPSHNOTIFY lppsn; pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER); switch (uMsg) { case WM_INITDIALOG: pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam; if (pGlobalData == NULL) return FALSE; SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData); /* Set the checkbox */ CheckDlgButton(hwndDlg, IDC_MOUSE_BOX, pGlobalData->mouseKeys.dwFlags & MKF_MOUSEKEYSON ? BST_CHECKED : BST_UNCHECKED); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_MOUSE_BOX: pGlobalData->mouseKeys.dwFlags ^= MKF_MOUSEKEYSON; PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; case IDC_MOUSE_BUTTON: if (DialogBoxParam(hApplet, MAKEINTRESOURCE(IDD_MOUSEKEYSOPTIONS), hwndDlg, (DLGPROC)MouseKeysDlgProc, (LPARAM)pGlobalData)) PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; default: break; } break; case WM_NOTIFY: lppsn = (LPPSHNOTIFY)lParam; if (lppsn->hdr.code == PSN_APPLY) { SystemParametersInfo(SPI_SETMOUSEKEYS, sizeof(MOUSEKEYS), &pGlobalData->mouseKeys, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE /*0*/); return TRUE; } break; } return FALSE; }