February 1st, 2013, 05:31 AM
In your find file code you are also not closing the find handle when finished. This will cause a resource leak. Once all the file names have been obtained then the handle should be closed as in
...
January 31st, 2013, 05:39 PM
Whoops, sorry - I've had a long day and brain is frazzled! Doing it this way you don't need to allocate memory as that would cause a memory leak! You just need lvi.pszText = data2.cFileName. My...
January 31st, 2013, 05:14 PM
Why are you using LPSTR_TEXTCALLBACK? If all you are trying to do is to populate a list box with file names then this can be done directly without using callback.
void CThisDlg::OnOK()
{...
January 31st, 2013, 04:27 PM
Looking back at your original code, you're got another problem.
struct testing
{
char* strFileName;
};
...
January 31st, 2013, 03:59 PM
If you allocate memory for node on the heap by using new, then you will need to deallocate that memory once you are finished with it using delete otherwise you will have a memory leak.
January 31st, 2013, 03:44 PM
As node is now an auto structure on the stack its address can't be used as an element of lvi as the address will be invalid when OnGetdispinfoList1 is called. A quick and dirty workaround for this is...
January 31st, 2013, 02:47 PM
pDispInfo->item.pszText needs to be a pointer to the text. You don't copy the text itself - you just set pszText to point to the start of the text to be stored. I don't know the structure of testing...