Thread: Sliders and Windows API

  1. #1
    Registered User AtomRiot's Avatar
    Join Date
    Jan 2003
    Posts
    120

    Sliders and Windows API

    How would i go about making a vertical slider bar that could control volume, i am using windows api with "windows.h" is there already something set up like this or how could i create it? i am using vc
    All Your Base Are Still Belong to Someone!!!
    And you Remember that!!!

  2. #2
    Registered User AtomRiot's Avatar
    Join Date
    Jan 2003
    Posts
    120

    Thumbs up

    would it be possible to just create a static box that is wide enough to show only the scroll bar if i gave it a vertical scroll bar?

    is there a way to re-skin those things, I was hoping for something that looked like the sliders in the volume control box for windows.

    if i was to use the static box method, could i get like a percentage of where its at or could i make it so many pixels and get it so i can use it to set the volume with fmod using the FSOUND_SetVolume function with the value from the scroll bar

    any input would be great, thanks in advance
    All Your Base Are Still Belong to Someone!!!
    And you Remember that!!!

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Have you looked at TrackBars?

    ie msctls_trackbar32

    using TBM_XXXXX msg's

    ie TBM_SETRANGE
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  4. #4
    Registered User AtomRiot's Avatar
    Join Date
    Jan 2003
    Posts
    120
    Where should i actually set those messages at? is it in the switch statement for the messages or right after the trackbar is defined in the wm_create case? use a SendMessage command???
    All Your Base Are Still Belong to Someone!!!
    And you Remember that!!!

  5. #5
    Registered User AtomRiot's Avatar
    Join Date
    Jan 2003
    Posts
    120
    wait, nevermind, i think i found it, there is an example on msdn thanks
    All Your Base Are Still Belong to Someone!!!
    And you Remember that!!!

  6. #6
    Registered User AtomRiot's Avatar
    Join Date
    Jan 2003
    Posts
    120

    Angry a zero problem

    i am having a problem with the track bar, whenever a user slides it, it willl show the appropriate value while the mouse button is still clicked but once they let go, it goes to zero my scroll message is here

    Code:
    case WM_VSCROLL:
    {
        int nPos=(short int)HIWORD(wParam);
       FSOUND_SetVolume(iStreamChannel,nPos);
       itoa(nPos,chPos,10);
       SetWindowText(GetDlgItem(hwnd, IDC_STEXT_PLYR20), chPos);
       break;
    }
    and my initialization of the trackbar here:

    Code:
    hTrackVolume = CreateWindowEx( 
      0,
      TRACKBAR_CLASS, 
      "Trackbar Control",
      WS_CHILD | WS_VISIBLE | 
      TBS_ENABLESELRANGE | TBS_AUTOTICKS |
      TBS_BOTH | TBS_VERT |
      TBS_FIXEDLENGTH ,
      565, 130,
      45, 170,
      hwnd,
      (HMENU)IDC_TRACK_VOLUME, 
      hInstance,
      NULL
    );
    SendMessage(hTrackVolume, TBM_SETRANGE, 
      (WPARAM) TRUE,
      (LPARAM) MAKELONG(1, 255));
    SendMessage(hTrackVolume, TBM_SETPOS, 
      (WPARAM) TRUE,
      (LPARAM) 5);
    SendMessage(hTrackVolume, TBM_SETPAGESIZE, 
      0, 
      (LPARAM) 10);
    SendMessage(hTrackVolume, TBM_SETTICFREQ,
      (WPARAM) 10,
      (LPARAM) 0);
    SetFocus(hTrackVolume);
    anyone see any problems, i know it is something stupid or something i screwed up

    any follow ups would be greatly appriciated
    All Your Base Are Still Belong to Someone!!!
    And you Remember that!!!

  7. #7
    Registered User AtomRiot's Avatar
    Join Date
    Jan 2003
    Posts
    120

    Talking Nevermind

    I figured it out once again, i put my melon to the test and it came out on top
    All Your Base Are Still Belong to Someone!!!
    And you Remember that!!!

Popular pages Recent additions subscribe to a feed