Why Is this false?
-
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!
-
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!
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? -
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?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. :-\
-
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!
-
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. :-\
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 :~
-
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
-
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 :~
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? :((