diff --git a/launchers/win32/LauncherDlg.cpp b/launchers/win32/LauncherDlg.cpp index 9cf21e9c8c..5d8db860e5 100644 --- a/launchers/win32/LauncherDlg.cpp +++ b/launchers/win32/LauncherDlg.cpp @@ -13,7 +13,10 @@ #include "LauncherApp.h" #include "LauncherDlg.h" +#include +#include #include + #pragma comment(lib, "d2d1") #ifdef _DEBUG @@ -84,7 +87,7 @@ END_MESSAGE_MAP() BOOL CLauncherDlg::OnInitDialog() { CDialog::OnInitDialog(); - + MarkWindowAsUnpinnable(); SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon @@ -129,6 +132,19 @@ BOOL CLauncherDlg::OnInitDialog() { return TRUE; } +void CLauncherDlg::MarkWindowAsUnpinnable() { + HWND hwnd = AfxGetMainWnd()->m_hWnd; + IPropertyStore* pps; + HRESULT hr = SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pps)); + if (SUCCEEDED(hr)) { + PROPVARIANT var; + var.vt = VT_BOOL; + var.boolVal = VARIANT_TRUE; + hr = pps->SetValue(PKEY_AppUserModel_PreventPinning, var); + pps->Release(); + } +} + POINT CLauncherDlg::getMouseCoords(MSG* pMsg) { POINT pos; pos.x = (int)(short)LOWORD(pMsg->lParam); diff --git a/launchers/win32/LauncherDlg.h b/launchers/win32/LauncherDlg.h index d25618c554..b0ccbfa04f 100644 --- a/launchers/win32/LauncherDlg.h +++ b/launchers/win32/LauncherDlg.h @@ -59,6 +59,7 @@ protected: BOOL getTextFormat(int ResID, TextFormat& formatOut); void showWindows(std::vector windows, bool show); POINT getMouseCoords(MSG* pMsg); + void MarkWindowAsUnpinnable(); bool _isConsoleRunning { false }; diff --git a/launchers/win32/LauncherUtils.cpp b/launchers/win32/LauncherUtils.cpp index ef23073ca5..cd0c15ccc3 100644 --- a/launchers/win32/LauncherUtils.cpp +++ b/launchers/win32/LauncherUtils.cpp @@ -150,7 +150,8 @@ BOOL LauncherUtils::launchApplication(LPCWSTR lpApplicationName, LPTSTR cmdArgs) ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); ZeroMemory(&pi, sizeof(pi)); - + + si.dwFlags = STARTF_TITLEISAPPID | STARTF_PREVENTPINNING; // start the program up BOOL success = CreateProcess( lpApplicationName, // the path