jobject createJumpListInteropItemObject()

in skiko/src/awtMain/cpp/windows/JumpList.cc [156:191]


jobject createJumpListInteropItemObject(JNIEnv* env, IShellLinkW *psl)
{
    org::jetbrains::skiko::windows::ensure(env);

    ComPtr<IPropertyStore> propStore;
    if (SUCCEEDED(psl->QueryInterface(IID_PPV_ARGS(&propStore)))) {
        PROPVARIANT propvar;
        if (SUCCEEDED(propStore->GetValue(PKEY_Title, &propvar))) {
            PropVariantWrapper propvarWrapper(propvar);
            WCHAR szTitle[512];
            if (SUCCEEDED(PropVariantToString(propvar, szTitle, ARRAYSIZE(szTitle)))) {
                WCHAR szArguments[1024];
                if (SUCCEEDED(psl->GetArguments(szArguments, ARRAYSIZE(szArguments)))) {
                    WCHAR szIconPath[512];
                    int numIcon;
                    if (SUCCEEDED(psl->GetIconLocation(szIconPath, ARRAYSIZE(szIconPath), &numIcon))) {
                        WCHAR szDescription[1024];
                        if (SUCCEEDED(psl->GetDescription(szDescription, ARRAYSIZE(szDescription)))) {
                            return env->NewObject(
                                org::jetbrains::skiko::windows::JumpListInteropItem::cls,
                                org::jetbrains::skiko::windows::JumpListInteropItem::init,
                                env->NewString(reinterpret_cast<const jchar*>(szTitle), wcsnlen_s(szTitle, ARRAYSIZE(szTitle))),
                                env->NewString(reinterpret_cast<const jchar*>(szArguments), wcsnlen_s(szArguments, ARRAYSIZE(szArguments))),
                                env->NewString(reinterpret_cast<const jchar*>(szDescription), wcsnlen_s(szDescription, ARRAYSIZE(szDescription))),
                                env->NewString(reinterpret_cast<const jchar*>(szIconPath), wcsnlen_s(szIconPath, ARRAYSIZE(szIconPath))),
                                numIcon
                            );
                        }
                    }
                }
            }
        }
    }

    return NULL;
}