mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 14:38:04 -06:00
Call Windows API directly
We already bumped the OS requirement to Windows 7 and those functions can be called directly without the need to load them first.
This commit is contained in:
@@ -685,11 +685,8 @@ void Application::cleanup()
|
||||
m_window->hide();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
typedef BOOL (WINAPI *PSHUTDOWNBRCREATE)(HWND, LPCWSTR);
|
||||
const auto shutdownBRCreate = Utils::Misc::loadWinAPI<PSHUTDOWNBRCREATE>("User32.dll", "ShutdownBlockReasonCreate");
|
||||
// Only available on Vista+
|
||||
if (shutdownBRCreate)
|
||||
shutdownBRCreate((HWND)m_window->effectiveWinId(), tr("Saving torrent progress...").toStdWString().c_str());
|
||||
::ShutdownBlockReasonCreate(reinterpret_cast<HWND>(m_window->effectiveWinId())
|
||||
, tr("Saving torrent progress...").toStdWString().c_str());
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
// Do manual cleanup in MainWindow to force widgets
|
||||
@@ -728,11 +725,7 @@ void Application::cleanup()
|
||||
#ifndef DISABLE_GUI
|
||||
if (m_window) {
|
||||
#ifdef Q_OS_WIN
|
||||
using PSHUTDOWNBRDESTROY = BOOL (WINAPI *)(HWND);
|
||||
const auto shutdownBRDestroy = Utils::Misc::loadWinAPI<PSHUTDOWNBRDESTROY>("User32.dll", "ShutdownBlockReasonDestroy");
|
||||
// Only available on Vista+
|
||||
if (shutdownBRDestroy)
|
||||
shutdownBRDestroy(reinterpret_cast<HWND>(m_window->effectiveWinId()));
|
||||
::ShutdownBlockReasonDestroy(reinterpret_cast<HWND>(m_window->effectiveWinId()));
|
||||
#endif // Q_OS_WIN
|
||||
delete m_window;
|
||||
UIThemeManager::freeInstance();
|
||||
|
||||
Reference in New Issue
Block a user