Пример #1
0
    static BOOL CALLBACK s_EnumInstalledAppProc(INT ItemIndex, LPWSTR lpName, PINSTALLED_INFO Info)
    {
        PINSTALLED_INFO ItemInfo;
        WCHAR szText[MAX_PATH];
        INT Index;

        if (!SearchPatternMatch(lpName, szSearchPattern))
        {
            RegCloseKey(Info->hSubKey);
            return TRUE;
        }

        ItemInfo = (PINSTALLED_INFO) HeapAlloc(GetProcessHeap(), 0, sizeof(INSTALLED_INFO));
        if (!ItemInfo)
        {
            RegCloseKey(Info->hSubKey);
            return FALSE;
        }

        RtlCopyMemory(ItemInfo, Info, sizeof(INSTALLED_INFO));

        Index = ListViewAddItem(ItemIndex, 0, lpName, (LPARAM) ItemInfo);

        /* Get version info */
        GetApplicationString(ItemInfo->hSubKey, L"DisplayVersion", szText);
        ListView_SetItemText(hListView, Index, 1, szText);

        /* Get comments */
        GetApplicationString(ItemInfo->hSubKey, L"Comments", szText);
        ListView_SetItemText(hListView, Index, 2, szText);

        return TRUE;
    }
Пример #2
0
BOOL
CALLBACK
EnumInstalledAppProc(INT ItemIndex, LPWSTR lpName, INSTALLED_INFO Info)
{
    PINSTALLED_INFO ItemInfo;
    WCHAR szText[MAX_PATH];
    INT Index;

    ItemInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(INSTALLED_INFO));
    if (!ItemInfo) return FALSE;

    *ItemInfo = Info;

    Index = ListViewAddItem(ItemIndex, 0, lpName, (LPARAM)ItemInfo);

    /* Get version info */
    GetApplicationString((HKEY)ItemInfo->hSubKey, L"DisplayVersion", szText);
    ListView_SetItemText(hListView, Index, 1, szText);
    /* Get comments */
    GetApplicationString((HKEY)ItemInfo->hSubKey, L"Comments", szText);
    ListView_SetItemText(hListView, Index, 2, szText);

    return TRUE;
}
Пример #3
0
BOOL
ShowInstalledAppInfo(INT Index)
{
    WCHAR szText[MAX_PATH], szInfo[MAX_PATH];
    PINSTALLED_INFO Info = (PINSTALLED_INFO) ListViewGetlParam(Index);

    if (!Info || !Info->hSubKey) return FALSE;

    GetApplicationString(Info->hSubKey, L"DisplayName", szText);
    NewRichEditText(szText, CFE_BOLD);

    InsertRichEditText(L"\n", 0);

#define GET_INFO(a, b, c, d) \
    if (GetApplicationString(Info->hSubKey, a, szInfo)) \
    { \
        LoadStringW(hInst, b, szText, sizeof(szText) / sizeof(WCHAR)); \
        InsertRichEditText(szText, c); \
        InsertRichEditText(szInfo, d); \
    } \

    GET_INFO(L"DisplayVersion", IDS_INFO_VERSION, CFE_BOLD, 0);
    GET_INFO(L"Publisher", IDS_INFO_PUBLISHER, CFE_BOLD, 0);
    GET_INFO(L"RegOwner", IDS_INFO_REGOWNER, CFE_BOLD, 0);
    GET_INFO(L"ProductID", IDS_INFO_PRODUCTID, CFE_BOLD, 0);
    GET_INFO(L"HelpLink", IDS_INFO_HELPLINK, CFE_BOLD, CFM_LINK);
    GET_INFO(L"HelpTelephone", IDS_INFO_HELPPHONE, CFE_BOLD, 0);
    GET_INFO(L"Readme", IDS_INFO_README, CFE_BOLD, 0);
    GET_INFO(L"Contact", IDS_INFO_CONTACT, CFE_BOLD, 0);
    GET_INFO(L"URLUpdateInfo", IDS_INFO_UPDATEINFO, CFE_BOLD, CFM_LINK);
    GET_INFO(L"URLInfoAbout", IDS_INFO_INFOABOUT, CFE_BOLD, CFM_LINK);
    GET_INFO(L"Comments", IDS_INFO_COMMENTS, CFE_BOLD, 0);
    GET_INFO(L"InstallDate", IDS_INFO_INSTALLDATE, CFE_BOLD, 0);
    GET_INFO(L"InstallLocation", IDS_INFO_INSTLOCATION, CFE_BOLD, 0);
    GET_INFO(L"InstallSource", IDS_INFO_INSTALLSRC, CFE_BOLD, 0);
    GET_INFO(L"UninstallString", IDS_INFO_UNINSTALLSTR, CFE_BOLD, 0);
    GET_INFO(L"InstallSource", IDS_INFO_INSTALLSRC, CFE_BOLD, 0);
    GET_INFO(L"ModifyPath", IDS_INFO_MODIFYPATH, CFE_BOLD, 0);

    return TRUE;
}
Пример #4
0
BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, ATL::CStringW& String)
{
    BOOL result = GetApplicationString(hKey, lpKeyName, String.GetBuffer(MAX_PATH));
    String.ReleaseBuffer();
    return result;
}