Visual C++ Programming
Ask questions about Windows programming with Visual C++ and help others by answering their questions.
CSliderCtrl event handeling
I have read many previous threads regaurding MFC CSliderCtrl's, and I still cant get the event handler to work.... I have a simple Slider with a range set (0,1); when the user moves the slider I want to recieve a message.... I have tried many things in my message map, according to my book this should work ON_NOTIFY(TB_ENDTRACK , IDC_SLIDER, OnRelay1Slider) the event handeler function is declared as protected afx_msg void OnRelay1Slider(NMHDR *pNMHDR, LRESULT *pResult); am i missing something here.... any suggestions or pointer will be greatly appreciated...thx
TB_THUMBTRACK dont work neither...
To which class have you added this handler ?
I added this handler to the same class in which the slider is declared, the class is dirived as followes CPropertyPage -> AnotherPropertyPage->MYPropertyPage(the one I am declaring and attempting to handle slider events in)....On a side note, Im handling ON_BN_CLICKED events just fine....
You need to handle WM_HSCROLL or WM_VSCROLL. Trackbar does not send WM_NOTIFY. Read this from MSDN: Trackbar Notification Messages A trackbar notifies its parent window of user actions by sending the parent a WM_HSCROLL or WM_VSCROLL message. A trackbar with the TBS_HORZ style sends WM_HSCROLL messages. A trackbar with the TBS_VERT style sends WM_VSCROLL messages. The low-order word of the wParam parameter of WM_HSCROLL or WM_VSCROLL contains the notification code. For the TB_THUMBPOSITION and TB_THUMBTRACK notifications, the high-order word of the wParam parameter specifies the position of the slider.
thx for your help... http://www.codeguru.com/forum/showth...hlight=CSlider