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. Why Is this false?

Why Is this false?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
7 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.
  • W Offline
    W Offline
    will1383
    wrote on last edited by
    #1

    Ok here's what I got: lvItemList.mask = LVIF_TEXT; lvItemList.iItem = indexNumber; lvItemList.iSubItem = 1; lvItemList.pszText = localdate; lvItemList.cchTextMax = strlen(localdate); ListView_SetItem(hwnd,&lvItemList); ListView_SetItem returns false???????? Why????? I can't find any information anywhere, and stepping through the assembly code has gotten me nowhere. I use the exact same code in another dialog box, and it works like a charm. What am I doing wrong????? Any help is greatly appreciated. Thanks!

    D V 2 Replies Last reply
    0
    • W will1383

      Ok here's what I got: lvItemList.mask = LVIF_TEXT; lvItemList.iItem = indexNumber; lvItemList.iSubItem = 1; lvItemList.pszText = localdate; lvItemList.cchTextMax = strlen(localdate); ListView_SetItem(hwnd,&lvItemList); ListView_SetItem returns false???????? Why????? I can't find any information anywhere, and stepping through the assembly code has gotten me nowhere. I use the exact same code in another dialog box, and it works like a charm. What am I doing wrong????? Any help is greatly appreciated. Thanks!

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Just a grasp but are the other members of lvItemList "nulled" out? Something like: LVITEM lvItemList = {0}; lvItemList.mask = LVIF_TEXT; lvItemList.iItem = indexNumber; lvItemList.iSubItem = 1; lvItemList.pszText = localdate; lvItemList.cchTextMax = strlen(localdate); ListView_SetItem(hwnd,&lvItemList); Is hwnd a valid window handle? Also, since you are just setting the text of a subitem, why not use ListView_SetItemText() instead?

      W 1 Reply Last reply
      0
      • D David Crow

        Just a grasp but are the other members of lvItemList "nulled" out? Something like: LVITEM lvItemList = {0}; lvItemList.mask = LVIF_TEXT; lvItemList.iItem = indexNumber; lvItemList.iSubItem = 1; lvItemList.pszText = localdate; lvItemList.cchTextMax = strlen(localdate); ListView_SetItem(hwnd,&lvItemList); Is hwnd a valid window handle? Also, since you are just setting the text of a subitem, why not use ListView_SetItemText() instead?

        W Offline
        W Offline
        will1383
        wrote on last edited by
        #3

        DavidCrow wrote: Just a grasp but are the other members of lvItemList "nulled" out? Something like: nope. trying that now. LOL DavidCrow wrote: Is hwnd a valid window handle? Yes it is a valid handle. Wish I could say it wasn't but it is. :confused: DavidCrow wrote: Also, since you are just setting the text of a subitem, why not use ListView_SetItemText() instea Yeah I tried that too, but it still doesn't set the subitem text. I have NO idea why. :-\

        W 1 Reply Last reply
        0
        • W will1383

          Ok here's what I got: lvItemList.mask = LVIF_TEXT; lvItemList.iItem = indexNumber; lvItemList.iSubItem = 1; lvItemList.pszText = localdate; lvItemList.cchTextMax = strlen(localdate); ListView_SetItem(hwnd,&lvItemList); ListView_SetItem returns false???????? Why????? I can't find any information anywhere, and stepping through the assembly code has gotten me nowhere. I use the exact same code in another dialog box, and it works like a charm. What am I doing wrong????? Any help is greatly appreciated. Thanks!

          V Offline
          V Offline
          valikac
          wrote on last edited by
          #4

          Format a section of memory for the LVITEM structure. memset(&lvItemList, 0, sizeof(lvItemList)); lvItemList.cchTextMax = 0; Make sure the item and subitem indices are valid. Kuphryn

          W 1 Reply Last reply
          0
          • W will1383

            DavidCrow wrote: Just a grasp but are the other members of lvItemList "nulled" out? Something like: nope. trying that now. LOL DavidCrow wrote: Is hwnd a valid window handle? Yes it is a valid handle. Wish I could say it wasn't but it is. :confused: DavidCrow wrote: Also, since you are just setting the text of a subitem, why not use ListView_SetItemText() instea Yeah I tried that too, but it still doesn't set the subitem text. I have NO idea why. :-\

            W Offline
            W Offline
            will1383
            wrote on last edited by
            #5

            will1383 wrote: DavidCrow wrote: Just a grasp but are the other members of lvItemList "nulled" out? Something like: nope. trying that now. LOL That's not working either. What the heck is going on? What else could I be missing? The function just retuns false with no error information returned from GetLastError or anything. This one's really got me stumped. Any more ideas? :-D :~

            1 Reply Last reply
            0
            • V valikac

              Format a section of memory for the LVITEM structure. memset(&lvItemList, 0, sizeof(lvItemList)); lvItemList.cchTextMax = 0; Make sure the item and subitem indices are valid. Kuphryn

              W Offline
              W Offline
              will1383
              wrote on last edited by
              #6

              kuphryn wrote: Format a section of memory for the LVITEM structure. memset(&lvItemList, 0, sizeof(lvItemList)); lvItemList.cchTextMax = 0; Make sure the item and subitem indices are valid. mmm.. trying away :~

              W 1 Reply Last reply
              0
              • W will1383

                kuphryn wrote: Format a section of memory for the LVITEM structure. memset(&lvItemList, 0, sizeof(lvItemList)); lvItemList.cchTextMax = 0; Make sure the item and subitem indices are valid. mmm.. trying away :~

                W Offline
                W Offline
                will1383
                wrote on last edited by
                #7

                ugh. Clearing out the memory isn't doing it either. Would make sense if the handle was bad or a pointer or two was bad, but I can't find any problems with them. It would help if Microsoft would actually give more error information instead of a BOOL being returned. That's utterly useless in this case. :~ I'm passing in the pointer to the function that makes this call and just setting the lvItemList.pszText to it. I tried copying over the text to a local pointer thinking that might be the problem, but that ain't it either. :( What else do I do? :((

                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