Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to sort the list box Items?

how to sort the list box Items?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ashokbngr
    wrote on last edited by
    #1

    can anyone helpme out how to sort listbox items as per our requirement,but not setting the properties sort option. :confused: SARVEJANA SUKINOBAVANTHU Ashok

    P C 2 Replies Last reply
    0
    • A ashokbngr

      can anyone helpme out how to sort listbox items as per our requirement,but not setting the properties sort option. :confused: SARVEJANA SUKINOBAVANTHU Ashok

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #2

      I think you have to do yourself the sort on the list items (provided you disable the sort option). If you have no performance issues a simple bubble sort may suffice.

      1 Reply Last reply
      0
      • A ashokbngr

        can anyone helpme out how to sort listbox items as per our requirement,but not setting the properties sort option. :confused: SARVEJANA SUKINOBAVANTHU Ashok

        P Offline
        P Offline
        peterchen
        wrote on last edited by
        #3

        using LVM_SORTITEMSEX message You need to pass it a function that compares two items and says whether the first goes before the second. The prototype is a global or static function int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); typically, you pass a pointer to the struct with the window handle of the list control and the information how to sort as "paramSort".


        Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
        We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
        Linkify!|Fold With Us!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups