Menu

WinAPI - ListBox + Scrolling msg

2002-12-05
2012-09-26
  • Nobody/Anonymous

    I know you guys hate this kind of questions, but im only asking that cause i couldnt find the answer here at the forum nor at MSDN...

    My app is sending messages to add content to a listbox (lb_addstring) but the scroolbar keep always at the top, so the user has to be always scrolling it down to see the more recent messages.

    So one solution would be if the new messages would enter the listbox above the old ones, not under it, no idea how to do it.

    The other solution would be sending a message to the listbox to scroll down every time a new message is sent. What is this message?

     
    • Nobody/Anonymous

      Here you go =)

      // Dump string out to list box...
      void StatusOut(char *pszMessage, HWND hListBox)
      {
          // Output the message...
          SendMessage(hListBox, LB_ADDSTRING, (WPARAM) -1, (LPARAM) pszMessage);
         
          // Scroll to the bottom...
          SendMessage(hListBox, WM_VSCROLL, SB_BOTTOM, 0);

          // Repaint window...
          UpdateWindow(hListBox);
      }

      Kip

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.