T
T
taskevich2021-10-30 06:30:47
C++ / C#
taskevich, 2021-10-30 06:30:47

C++ How to handle trackbar?

Hello. I need to show the position of the slider in the window when scrolling the slider.

sliders and windows:

HWND* track = new HWND;
HWND* window= new HWND;


Window and slider creation cycle:
value - how many windows and sliders are needed
for (i = 0; i < value; i++)
  {
    track[i] = CreateWindowEx(0,TRACKBAR_CLASS, L"", WS_CHILD | WS_VISIBLE | TBS_AUTOTICKS | TBS_ENABLESELRANGE, 200, 150+(i*30), 150, 30, hWnd, 0,0,0);
    window[i] = CreateWindow(L"static", L"", WS_CHILD | WS_VISIBLE | WS_BORDER, 350, 150+(i*30), 40, 20, hWnd, 0, nullptr, nullptr);
    SendMessage(track[i], TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(0, 100));
    SendMessage(track[i], TBM_SETPAGESIZE, 0, (LPARAM)4);
    SendMessage(track[i], TBM_SETSEL, (WPARAM)FALSE, (LPARAM)MAKELONG(0, 100));
    SendMessage(track[i], TBM_SETPOS, (WPARAM)TRUE, (LPARAM)0);
    SetFocus(track[i]);
  }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question