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. LVM_SORTITEMS

LVM_SORTITEMS

Scheduled Pinned Locked Moved C / C++ / MFC
algorithms
2 Posts 2 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.
  • C Offline
    C Offline
    CaesarCZ
    wrote on last edited by
    #1

    Hi, I got a Listview control which is ownerdata driven. I want to sort it but the LVM_SORTITEMS function just fails... I am not sure if it's relevant, but the GetLastError() return that the params are invalid. I checked it 20 times, the compare function is all right (CALLBACK, right params, return... all). I tried passing both NULL and some dummy to as the LPARAM (though it shouldn't ake any difference cause I don't do anything with them later). The HWND is valid and is used before and after this piece of code. The only thing that comes on my mind is that sorting isn't supported with ownderdata, but I haven't found a single line regarding this... Thanks!

    T 1 Reply Last reply
    0
    • C CaesarCZ

      Hi, I got a Listview control which is ownerdata driven. I want to sort it but the LVM_SORTITEMS function just fails... I am not sure if it's relevant, but the GetLastError() return that the params are invalid. I checked it 20 times, the compare function is all right (CALLBACK, right params, return... all). I tried passing both NULL and some dummy to as the LPARAM (though it shouldn't ake any difference cause I don't do anything with them later). The HWND is valid and is used before and after this piece of code. The only thing that comes on my mind is that sorting isn't supported with ownderdata, but I haven't found a single line regarding this... Thanks!

      T Offline
      T Offline
      TigerNinja_
      wrote on last edited by
      #2

      CaesarCZ wrote: The only thing that comes on my mind is that sorting isn't supported with ownderdata, but I haven't found a single line regarding this... It is supported with CListBox. With CListBox an owner-drawn list box created w/ style LBS_SORT and items are added to it w/ AddString, then CListBox::CompareItem must be overridden with a version that compares two arbitrary items packaged in COMPAREITEMSTRUCT structures.


      Soliant | email   "The whole of science is nothing more than a refinement of everyday thinking." -Albert E.

      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