Catalin

Catalin

  • NA
  • 10
  • 8.1k

Control a volume track bar

Sep 20 2012 8:14 AM
        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.