LPMALLOC, IMalloc problems.
I am using SHBrowseForFolder (function), BROWSEINFO (structure), SHGetMalloc(function), and LPMALLOC(structure) to ask the user to select a folder. But when I try to free the memory allocated by SHGetMalloc, I get this error:
Code:
error C2039: 'Free' : is not a member of 'IMalloc'
c:\program files\microsoft sdk\include\objidl.h(1103) : see declaration of 'IMalloc'
Here is my code:
Code:
case IDC_CLICK_OPENDIR:
{
char x[MAX_PATH];
BROWSEINFO binfo;
HRESULT HR;
LPITEMIDLIST idList = 0;
LPMALLOC pMalloc;
HR = SHGetMalloc(&pMalloc);
if(FAILED(HR))
{
MessageBox(hWnd, "shgetmalloc failed.", "error", MB_OK);
return;
}
binfo.hwndOwner = hWnd;
binfo.pszDisplayName = x;
binfo.ulFlags = BIF_USENEWUI;
binfo.lpfn = NULL;
binfo.pidlRoot = 0;
binfo.lpszTitle = "Title Here";
binfo.lParam = 0;
idList = SHBrowseForFolder(&binfo);
SHGetPathFromIDList(idList, x);
SetDlgItemText(hWnd, IDC_EDIT_FILETOSAVE, x);
pMalloc->Free(idList);//ERROR here.
break;
}
lil help please, thanks ;)