like in title described i have this problem!
That because, if i click in my CListCtrl i try to find what is the text in this cell!
I do it now like this:
// in this way i don't receive my text:
LPNMLISTVIEW lpItem = (LPNMLISTVIEW)pNMHDR;
lvItem.mask = LVIF_TEXT;
lvItem.iItem = lpItem->iItem;
lvItem.iSubItem = lpItem->iSubItem;
// but lvItem.pszText is empty, or not readable content :(// this works(but why not the sample above with LVITEM?):
csIndex = m_cListAll.GetItemText(lpItem->iItem, 0);
csItemText= m_cListAll.GetItemText(lpItem->iItem, 1);
Why not use the code that works? If you're using MFC, let MFC do the work.
You can also trace into the working code and see how it differs from your code.
Back to your broken code...
The docs for LVM_GETITEM state:
"If the LVIF_TEXT flag is set in the mask member of the LVITEM structure,
the pszText member must point to a valid buffer and the cchTextMax member
must be set to the number of characters in that buffer. Applications should
not assume that the text will necessarily be placed in the specified buffer.
The control may instead change the pszText member of the structure to point
to the new text rather than place it in the buffer."
I am using GetProfileString to read from registry, the registry keys are created via setup and i should check if there is an option set, and the program should act accordingly.
I have to check if Data01 available, if yes then read its setting from the registry, otherwise do the default handling.
However when i check if Data01 available, GetProfileString creates that entry for me , if that entry is there no problem but if it is not, then it automatically creates. You can see how i am trying to check.
category+=dataCode; // DataCode could be Data01 or Data02 i dont know this before hand.
path = GetProfileString(category,_T("InitPath"));
How should i check if an entry there using GetProfileString or how can i do it?
I was feeling generous. You know, I'm all for helping folks out of a jam, and even going the extra mile on occasion, but there comes a point when these posters have to grow up and start getting a clue. This next generation of developers is scaring me!
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
You don't need a cast to go from T* to const T*. And please don't suggest a cast for going from const T* to T* without knowing what the OP is actually doing. Teaching new C++ programmers that casts solve everything is really detrimental.
Indeed, I didn't say this was good or recommended only that it was what he was looking for. In fact I'm no fan of the way const-ness is implemented in C++ at all and I don't take it nearly to the 'religious' extremes that some people do. I'd also prefer it if all type casts had to be explicitly implemented, even for builtin types but that's another issue.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
I have used Generate Preprocessed File feature of VC to dump preprocessed information, my confusion is about how to read .i file, how do we treat/read the lines begin with "#line"? My confusion is for such output, typedef size_t rsize_t is surrounded by 5 #line statements. How to read them? I am really confused.
#line 470 "d:\\program files\\microsoft visual studio 9.0\\vc\\include\\crtdefs.h"
#line 472 "d:\\program files\\microsoft visual studio 9.0\\vc\\include\\crtdefs.h"
#line 473 "d:\\program files\\microsoft visual studio 9.0\\vc\\include\\crtdefs.h"
typedef size_t rsize_t;
#line 488 "d:\\program files\\microsoft visual studio 9.0\\vc\\include\\crtdefs.h"
#line 489 "d:\\program files\\microsoft visual studio 9.0\\vc\\include\\crtdefs.h"