1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Fixed stuck taskbar buttons

This commit is contained in:
narzoul 2022-06-07 11:58:27 +02:00
parent 5ce5ea0668
commit d39a4ab0fc
3 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,4 @@
#include <ShObjIdl.h>
#include <Windows.h> #include <Windows.h>
#include <Common/Log.h> #include <Common/Log.h>
@ -61,6 +62,7 @@ namespace
unsigned WINAPI messageWindowThreadProc(LPVOID /*lpParameter*/) unsigned WINAPI messageWindowThreadProc(LPVOID /*lpParameter*/)
{ {
ImmDisableIME(0); ImmDisableIME(0);
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
WNDCLASS wc = {}; WNDCLASS wc = {};
wc.lpfnWndProc = &messageWindowProc; wc.lpfnWndProc = &messageWindowProc;
@ -126,6 +128,21 @@ namespace Gdi
return hwnd; return hwnd;
} }
void deleteTaskbarTab(HWND hwnd)
{
execute([&]()
{
ITaskbarList* taskbarList = nullptr;
if (SUCCEEDED(CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_INPROC_SERVER, IID_ITaskbarList,
reinterpret_cast<void**>(&taskbarList))))
{
taskbarList->lpVtbl->HrInit(taskbarList);
taskbarList->lpVtbl->DeleteTab(taskbarList, hwnd);
taskbarList->lpVtbl->Release(taskbarList);
}
});
}
void destroyWindow(HWND hwnd) void destroyWindow(HWND hwnd)
{ {
execute([&]() { DestroyWindow(hwnd); }); execute([&]() { DestroyWindow(hwnd); });

View File

@ -17,6 +17,7 @@ namespace Gdi
{ {
HWND createWindow(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, HWND createWindow(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle,
int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam); int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
void deleteTaskbarTab(HWND hwnd);
void destroyWindow(HWND hwnd); void destroyWindow(HWND hwnd);
void setWindowRgn(HWND hwnd, Gdi::Region rgn); void setWindowRgn(HWND hwnd, Gdi::Region rgn);

View File

@ -297,6 +297,7 @@ namespace
if (Gdi::Window::isTopLevelWindow(hwnd)) if (Gdi::Window::isTopLevelWindow(hwnd))
{ {
Gdi::Window::updateAll(); Gdi::Window::updateAll();
Gdi::GuiThread::deleteTaskbarTab(hwnd);
return; return;
} }