/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
DWORD pid;
HRESULT hr = pIf->ActivateApplication(L"windows.immersivecontrolpanel_cw5n1h2txyewy"
L"!microsoft.windows.immersivecontrolpanel",
L"page=SettingsPageAppsDefaults", AO_NONE, &pid); if (SUCCEEDED(hr))
{ // Do not check error because we could at least open // the "Default apps" setting.
pIf->ActivateApplication(L"windows.immersivecontrolpanel_cw5n1h2txyewy"
L"!microsoft.windows.immersivecontrolpanel",
L"page=SettingsPageAppsDefaults"
L"&target=SettingsPageAppsDefaultsDefaultAppsListView",
AO_NONE, &pid);
}
}
static HRESULT
IsPathDefaultForClass(sal::systools::COMReference<IApplicationAssociationRegistration>& pAAR,
LPCWSTR aClassName, LPCWSTR progID)
{ // Make sure the Prog ID matches what we have
sal::systools::CoTaskMemAllocated<wchar_t> registeredApp;
HRESULT hr
= pAAR->QueryCurrentDefault(aClassName, AT_FILEEXTENSION, AL_EFFECTIVE, ®isteredApp); if (SUCCEEDED(hr))
{ if (wcsnicmp(registeredApp, progID, wcslen(progID)) == 0)
hr = S_OK; else
hr = S_FALSE;
}
// LaunchAdvancedAssociationUI only works for applications registered under // Software\RegisteredApplications. See scp2/source/ooo/registryitem_ooo.scp const OUString expanded = Translate::ExpandVariables("%PRODUCTNAME %PRODUCTVERSION");
pIf->LaunchAdvancedAssociationUI(o3tl::toW(expanded.getStr()));
}
} catch (...)
{ // Just ignore any error here: this is not something we need to make sure to succeed
}
}
void CheckFileExtRegistration(weld::Window* pDialogParent)
{ if (!officecfg::Office::Common::Misc::PerformFileExtCheck::get()) return;
if (!IsDefaultAppInstalledInReg()) return;
sal::systools::CoInitializeGuard aGuard(COINIT_APARTMENTTHREADED, false,
sal::systools::CoInitializeGuard::WhenFailed::NoThrow);
sal::systools::COMReference<IApplicationAssociationRegistration> pAAR; try
{
pAAR.CoCreateInstance(CLSID_ApplicationAssociationRegistration, nullptr,
CLSCTX_INPROC_SERVER);
} catch (...)
{ // Just return on any error here: this is not something we need to make sure to succeed return;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.