MSDN > フォーラム ホーム > Visual C++ General > Trackbar Notifications
質問する質問する
 

回答済みTrackbar Notifications

  • 2009年7月2日 21:34lesnaubrTSC ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    I am trying to get some notification messages when a trackbar slider is moved and when the slider is released by releasing a mouse press.

    I am already getting the NM_RELEASEDCAPTURE notification when the mouse button is released. I cannot figure out what notification is sent when the trackbar thumb is moved.

    Thanks in advance.

回答

すべての返信

  • 2009年7月3日 3:10Scott McPhillipsMVPユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     回答済み
    When the slider is moved with a mouse drag it sends WM_HSCROLL (or WM_VSCROLL) with nSBCode == TB_THUMBTRACK.

    When the user releases the slider it sends the same scroll message with nSBCode == TB_THUMBPOSITION.
  • 2009年7月6日 13:20lesnaubrTSC ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    I'm not sure why but I can never see those notifications occurring. I can see notifications such as NM_RELEASEDCAPTURE. Maybe I'm checking notifications on the wrong CWnd?

    In case it is important, This slider is part of a dialog window which is a child window of a save dialog.
  • 2009年7月6日 13:57Scott McPhillipsMVPユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    You are seeing WM_NOTIFY messages, but the control also sends WM_HSCROLL (or WM_VSCROLL) messages.  Does your message handling intercept those messages?
  • 2009年7月6日 14:30lesnaubrTSC ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    I have an OnNotify method that seems to intercept all of the WM_NOTIFY messages. I tried using an OnHScroll method but I still cannot get a TB_THUMBTRACK or TB_THUMBPOSITION message.
  • 2009年7月6日 15:13Scott McPhillipsMVPユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     

    Show your code for OnHScroll.  Is it called?

     

  • 2009年7月6日 15:44lesnaubrTSC ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     コードあり
    Nothing is inside my OnHScroll function yet. I just have a variable assignment so that I can set a breakpoint to check if the function is called. It has not been called in my program but the OnNotify function continues to be called.

    void CAlphaImgFileSave::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
    {
       int i = 0;
    }

  • 2009年7月6日 16:21lesnaubrTSC ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     コードあり
    I think I just figured out my problem. It was a very small and stupid mistake on my part. I forgot to add:

    BEGIN_MESSAGE_MAP(CAlphaImgFileSave, CFileDialog)
       ON_WM_HSCROLL()
    END_MESSAGE_MAP()
  • 2009年7月6日 16:28Scott McPhillipsMVPユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    The OnHScroll must be in the control's parent window.  Is your OnHScroll in the same class that receives the OnNotify?  Does that class have ON_WM_HSCROLL() in its message map?

  • 2009年7月6日 16:38lesnaubrTSC ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     
    Yes, it is in the same class as OnNotify. At first, it was not in the message map. I noticed that mistake and pointed it out above. It was a dumb mistake on my part but I think my problem is solved now.

    Thanks!