0
Answer

Control a volume track bar

Catalin

Catalin

12y
2.3k
1
        I'm trying to control a volume track bar but, until now I managed only to move the slider without changing the volume. This is the code that I used:

const uint TBM_GETPOS = 0x0400;

const uint TBM_SETPOS = 0x0405;

const int intCID = 10102;

public static void control_sopcast(IntPtr handle, int val_volume)

    {

        IntPtr pControl;

        IntPtr cControl;

        pControl = FindWindowEx(handle, IntPtr.Zero, "#32770", null);

        cControl = GetDlgItem(pControl, intCID);


        SendMessage(cControl, TBM_SETPOS, 1, val_volume);

SendMessage(pControl, WM_HSCROLL, 5, (int)cControl);

    }

Can someone help me with this? Thanks.