Controlling a trackbar

This is a discussion on Controlling a trackbar within the C++ Programming forums, part of the General Programming Boards category; Ok, I have written a program that controls a trackbar on another program. I have succeeded in making this trackbar ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    22

    Controlling a trackbar

    Ok, I have written a program that controls a trackbar on another program. I have succeeded in making this trackbar move using set_range and set_pos. Unfourtunatly the target program will not acknowledge the fact that the slider has moved. For example, there is static text next to the trackbar giving it's current value. When you move the slider with the mouse the static text changes. When you move it using the set_pos the track bar moves but the staic text doesnt change. This tells me that the variable being linked the trackbar is not being refreshed or something else may be wrong.

    Just for future reference, the program I'm trying to control was not written by me so I'm using SendMessage() to give it commands. Also, If I move the bar and than click it with the mouse the value on the static text refreshes.

    Does anyone know how I could simulate a user exactly through windows messages? Or if possibly there is a message I can send it to refresh the variable attached to it. Either way, this is my last problem for my final project with is due in two weeks so I'd be very grateful to anyone who can get me back on track.

    Using SPY++ I notice that the program I am trying to control send these messages when using the trackbar with the mouse:
    -WM_MOUSEACTIVATE
    -WM_HSCROLL->SB_THUMBTRACK
    -WM_HSCROLL->SB_THUMBPOSITION
    -WM_HSCROLL->SB_ENDSCROLL
    -WM_NOTIFY
    -WM_SETCURSOR

  2. #2
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    The reason it it doing this is because when you scroll the slider in the other program, it sends more than one type of message saying that it has been scrolled (Most likely WM_HSCROLL is one of them) and that the value must be refreshed, but when you set it with your program, it only sends the message needed to set the trackbar, it doesn't send anything else.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating a window causes a trackbar to stop working?
    By kidburla in forum Windows Programming
    Replies: 2
    Last Post: 09-20-2007, 05:44 AM
  2. Trackbar controls
    By dalek in forum Windows Programming
    Replies: 2
    Last Post: 05-12-2004, 10:39 PM
  3. Controlling Repetition in a Structure
    By Silence in forum C Programming
    Replies: 2
    Last Post: 08-23-2002, 05:35 PM
  4. Controlling terminal tty
    By pdstatha in forum C Programming
    Replies: 0
    Last Post: 04-02-2002, 02:57 AM
  5. Controlling the parallel port in C++
    By Monkey_Drone in forum C++ Programming
    Replies: 3
    Last Post: 02-06-2002, 07:18 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21