| 14 | } |
| 15 | |
| 16 | void SliderCtrl::OnInit(HWND hParent, int sliderID, int sliderInfoID) |
| 17 | { |
| 18 | m_hParent = hParent; |
| 19 | m_hSelf = GetDlgItem(m_hParent, sliderID); |
| 20 | m_hSelfInfo = GetDlgItem(m_hParent, sliderInfoID); |
| 21 | |
| 22 | // Set slider range and initial position |
| 23 | SendMessage(m_hSelf, TBM_SETRANGE, TRUE, MAKELPARAM(m_sliderRange.m_nMinZoom, m_sliderRange.m_nMaxZoom)); |
| 24 | SendMessage(m_hSelf, TBM_SETPOS, TRUE, m_sliderRange.m_nDefault); |
| 25 | SendMessage(m_hSelf, TBM_SETPAGESIZE, 0, m_sliderRange.m_nSteps); |
| 26 | |
| 27 | UpdateInfo(m_sliderRange.m_nDefault); |
| 28 | |
| 29 | // Subclass the slider control to handle double-click events |
| 30 | m_oldSliderProc = reinterpret_cast<WNDPROC>(SetWindowLongPtr(m_hSelfInfo, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(runWinProc))); |
| 31 | |
| 32 | // Save this instance for access in the static window procedure |
| 33 | SetWindowLongPtr(m_hSelfInfo, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); |
| 34 | } |
| 35 | |
| 36 | auto SliderCtrl::GetPosition() const -> int |
| 37 | { |