mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07: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:
parent
975b44d05f
commit
7276a79cef
5 changed files with 15 additions and 39 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue