Click here to Skip to main content
15,848,349 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have made a control slider for brightness.

a.Change its ID to IDC_H_SLIDER_BAR
b.Orientation to Horizontal
c.Category to Control
d.Variable Name to m_HSliderBar
e.Variable Type to CSliderCtrl
f.Select the Messages button in main properties,Scroll down to WM_VSCROLL and click on "ADD OnVScroll"

What should I do next, please reply.
Updated 9-Jun-10 23:56pm

1 solution

Add a variable of type int for your slider to get easy access to its value.

in header for you dialog
    int GetBrightness() const { return m_sliderValue; }
    void SetBrightness(int brightness) { m_sliderValue = brightness; }
    int m_sliderValue; // Value added for control

For simple tasks you don't need an event handler.

Notice that you will get something like
DDX_Slider(pDX, IDC_H_SLIDER_BAR, m_sliderValue);

in your DoDataExchange function. It will take care of transferring the controls value to your member variable.

For more reading you can check out UpdateData() in the SDK.

You will only need an event handler if you plan on having a preview of your brightness value.

Also, you want to set the range for your slider from your OnInitDialog() method.

m_HSliderBar.SetRange(0, 100);
Share this answer
Sweety Khan 19-Jun-10 4:17am    
every thing is done but i give range like this
slider.SetRangeMin(0, false);
slider.SetRangeMax(9, false);
but it still shows from 0-100 when i move slider.

waiting for ur reply........

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900