Thread: Handling multiple sliders (trackbars)

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    596

    Handling multiple sliders (trackbars)

    I have several sliders which I am using to simulate audio circuit controls. These were created with a resource editor as controls in a dialog.

    The message received by the dialog procedure is WM_VSCROLL.

    HIWORD(wParam) contains the slider position.
    LOWORD(wParam) contains the notification code TB_THUMBTRACK, when the slider is moved, and TB_THUMBPOSITION when the slider is released.
    This works fine if there is only one slider.

    Normally I use the ID of a control (an int) in a switch statememnt to handle messages from them. Other controls simply send the control ID with the WM_COMMAND message. But in order to see which of several sliders has been moved, I only have the handle of the control, which is contained in lParam. I believe the control ID is really what I want, but I don't see any way to get it. Or is there some other way this is normally handled?

    -
    Last edited by megafiddle; 10-12-2015 at 06:39 PM.

  2. #2
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    Ok, I found what I needed. It was in the Dialog Box reference section.

    The function, GetDlgCtrlID(HWND hwndCtl), returns the ID.

    -

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error handling for multiple inputs at once
    By sudozax in forum C Programming
    Replies: 3
    Last Post: 10-01-2015, 11:48 PM
  2. Need Help in Handling Multiple Files
    By Gaurav Singh in forum C Programming
    Replies: 1
    Last Post: 05-15-2011, 02:42 PM
  3. Exception handling framework based on multiple inheritance
    By Mario F. in forum C++ Programming
    Replies: 11
    Last Post: 06-25-2007, 10:17 AM
  4. multiple file handling
    By sloke in forum C Programming
    Replies: 2
    Last Post: 11-18-2005, 12:55 PM
  5. Multiple Trackbars and controling them both
    By AtomRiot in forum Windows Programming
    Replies: 2
    Last Post: 11-28-2004, 10:07 PM