示例#1
0
LPITEMIDLIST CBandSiteMenu::_GetQLaunchPidl(BOOL refresh)
{
    if (m_QLaunchPidl != NULL)
    {
        if (refresh)
            m_QLaunchPidl.Free();
        else
            return m_QLaunchPidl;
    }

    WCHAR buffer[MAX_PATH];
    HRESULT hr = SHGetFolderPathAndSubDirW(0, CSIDL_APPDATA, NULL, 0, L"Microsoft\\Internet Explorer\\Quick Launch", buffer);
    if (FAILED_UNEXPECTEDLY(hr))
        return NULL;

    m_QLaunchPidl.Attach(ILCreateFromPathW(buffer));
    return m_QLaunchPidl;
}
示例#2
0
static BOOL CreateShortcuts(HINF hinf, LPCWSTR szSection)
{
    INFCONTEXT Context;
    WCHAR szPath[MAX_PATH];
    WCHAR szFolder[MAX_PATH];
    WCHAR szFolderSection[MAX_PATH];
    INT csidl;

    CoInitialize(NULL);

    if (!SetupFindFirstLine(hinf, szSection, NULL, &Context))
        return FALSE;

    do
    {
        if (SetupGetFieldCount(&Context) < 2)
            continue;

        if (!SetupGetStringFieldW(&Context, 0, szFolderSection, MAX_PATH, NULL))
            continue;

        if (!SetupGetIntField(&Context, 1, &csidl))
            continue;

        if (!SetupGetStringFieldW(&Context, 2, szFolder, MAX_PATH, NULL))
            continue;

        if (FAILED(SHGetFolderPathAndSubDirW(NULL, csidl|CSIDL_FLAG_CREATE, (HANDLE)-1, SHGFP_TYPE_DEFAULT, szFolder, szPath)))
            continue;

        CreateShortcutsFromSection(hinf, szFolderSection, szPath);

    }while (SetupFindNextLine(&Context, &Context));

    CoUninitialize();

    return TRUE;
}