void LoadFolder(Folder *pFolder, int iconsize, bool is_visible, HWND hwnd)
{
    struct pidl_node *pidl_list;
    LPCITEMIDLIST pIDFolder;

    pidl_list = get_folder_pidl_list (pFolder->path);
    pFolder->pidl_list = pidl_list;
    if (NULL==pidl_list)
        return;

    pIDFolder = first_pidl(pidl_list);
    pFolder->id_notify = add_change_notify_entry(hwnd, pIDFolder);

    Item **ppItems = &pFolder->items;
    while (pidl_list)
    {
        LPCITEMIDLIST pIDFolder = first_pidl(pidl_list);

        struct enum_files *ef;
        if (ef_open(pIDFolder, &ef) && is_visible)
        {
            while (ef_next(ef))
            {
                int attr;
                struct pidl_node *pidl;

                if (0 == ef_getpidl(ef, &pidl))
                    continue;
                ef_getattr(ef, &attr);

                Item *item = new Item;
                item->is_folder = 0 != (attr & ef_folder);
                item->data = pidl;
                sh_get_icon_and_name(first_pidl(pidl), &item->hIcon, iconsize, item->szTip, sizeof item->szTip);

                // add item to the list
                item -> next = *ppItems, *ppItems = item;
            }
            ef_close(ef);
        }
        pidl_list = pidl_list -> next;
    }
    pFolder->items = join_folders(pFolder->items);
}
Example #2
0
const struct _ITEMIDLIST *SpecialFolderItem::check_pidl(void)
{
	if (NULL == m_pidl_list && m_pszPath)
		m_pidl_list = get_folder_pidl_list(m_pszPath);
	return m_pidl_list ? m_pidl_list->v : NULL;
}