static void notifyParent( HWND hwnd, UINT code = 0 ) { // NM_ code TODO NMRANGESLIDER nm = { { 0 } }; nm.hdr.hwndFrom = hwnd; nm.hdr.idFrom = GetWindowID( hwnd ); nm.hdr.code = code; nm.rsInfo._lower = getLower ( hwnd ); nm.rsInfo._upper = getUpper ( hwnd ); nm.rsInfo._start = getStart ( hwnd ); nm.rsInfo._end = getEnd ( hwnd ); nm.rsInfo._minRange = getMinRange ( hwnd ); nm.rsInfo._granularity = getGranularity( hwnd ); FORWARD_WM_NOTIFY( GetParent( hwnd ), nm.hdr.idFrom, &nm, SNDMSG ); }
//WM_INITDIALOG BOOL PBSettings_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) { (void) hwndFocus; //To avoid the warning //Associate the parameters to the window SetWindowLongPtr(hwnd,GWLP_USERDATA,(__int3264)(LONG_PTR)lParam); //Get the PBSDP PenBrushSettingsDlgParam * pbsdp=(PenBrushSettingsDlgParam *)(LONG_PTR)GetWindowLongPtr(hwnd,GWLP_USERDATA); //Create the tabs TCITEM ti; //Foreground tab ti.pszText=const_cast<LPTSTR>(langFile->GetString(IDS_PB_TABS_FG).c_str()); ti.mask=TCIF_TEXT; if((pbsdp->fgTabIndex=TabCtrl_InsertItem(GetDlgItem(hwnd,IDC_PB_TABS),0,&ti))==-1) throw std::runtime_error(ERROR_STD_PROLOG "TabCtrl_InsertItem returned -1 creating the \"Foreground\" tab."); //Background tab ti.pszText=const_cast<LPTSTR>(langFile->GetString(IDS_PB_TABS_BG).c_str()); if((pbsdp->bgTabIndex=TabCtrl_InsertItem(GetDlgItem(hwnd,IDC_PB_TABS),1,&ti))==-1) throw std::runtime_error(ERROR_STD_PROLOG "TabCtrl_InsertItem returned -1 creating the \"Background\" tab."); //Select the right tab TabCtrl_SetCurSel(GetDlgItem(hwnd,IDC_PB_TABS),pbsdp->GetActiveTabIndex()); //Send a fake notification NMHDR nmh; nmh.code=TCN_SELCHANGE; nmh.hwndFrom=GetDlgItem(hwnd,IDC_PB_TABS); nmh.idFrom=IDC_PB_TABS; FORWARD_WM_NOTIFY(hwnd,IDC_PB_TABS,&nmh,SendMessage); //Setup the updown control //Set the range of the width updown control SendDlgItemMessage(hwnd,IDC_PB_UD_WIDTH,UDM_SETRANGE,0,(LPARAM) MAKELONG((short) MAXPENWIDTH, (short) MINPENWIDTH)); //Init some other controls ColorUtils2CommonControls(hwnd); //Subclass the textbox SetWindowLongPtr(GetDlgItem(hwnd,IDC_PB_P_TX_CUSTOM),GWLP_USERDATA,(__int3264)(LONG_PTR)SetWindowLongPtr(GetDlgItem(hwnd,IDC_PB_P_TX_CUSTOM),GWLP_WNDPROC,(__int3264)(LONG_PTR)SubclTxtProc)); //Load the captions of the child windows (and of itself) langFile->InitializeDialogCaptions(hwnd, IDD_PENBRUSHSETTINGS); return TRUE; }