Windows allows people to pin an application to their taskbar, when a user pins blender, the data we set in `GHOST_WindowWin32::registerWindowAppUserModelProperties` is used which includes the path to the `blender-launcher.exe`. Now once that shortcut is created on the taskbar, this will never be updated, if people remove blender and install it again to a different path (happens often when using nightly builds) this leads to the situation where the shortcut on the taskbar points to a no longer existing blender installation. Now you may think, just un-pin and re-pin that should clear that right up! It doesn't, it'll keep using the outdated path till the end of time and there's no window API call we can do to update this information. However this shortcut is stored in the user profile in a sub-foder we can easily query, from there, we can iterate over all files, look for the one that has our appid in it, and when we find it, update the path to the blender launcher to the current installation, bit of a hack, but Microsoft seemingly offers no other way to deal with this problem. Pull Request: https://projects.blender.org/blender/blender/pulls/113859
49 lines
746 B
C++
49 lines
746 B
C++
/* SPDX-FileCopyrightText: 2022 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
/** \file
|
|
* \ingroup bli
|
|
* \brief COM helper functions for windows
|
|
*/
|
|
|
|
#ifndef _WIN32
|
|
# error "This include is for Windows only!"
|
|
#endif
|
|
|
|
#include "BLI_sys_types.h"
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#ifndef NOMINMAX
|
|
# define NOMINMAX
|
|
# include <windows.h>
|
|
# undef NOMINMAX
|
|
#else
|
|
# include <windows.h>
|
|
#endif
|
|
|
|
namespace blender {
|
|
class CoInitializeWrapper {
|
|
HRESULT _hr;
|
|
|
|
public:
|
|
CoInitializeWrapper(DWORD flags)
|
|
{
|
|
_hr = CoInitializeEx(nullptr, flags);
|
|
}
|
|
~CoInitializeWrapper()
|
|
{
|
|
if (SUCCEEDED(_hr)) {
|
|
CoUninitialize();
|
|
}
|
|
}
|
|
operator HRESULT()
|
|
{
|
|
return _hr;
|
|
}
|
|
};
|
|
} // namespace blender
|