Merge pull request #16127 from amerhifi/master

case DEV-492:  Ensure launcher cannot be pinned
This commit is contained in:
Shannon Romano 2019-09-05 14:29:38 -07:00 committed by GitHub
commit b3c7ca6e8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 2 deletions

View file

@ -13,6 +13,8 @@
#include "LauncherApp.h"
#include "LauncherDlg.h"
#include <propsys.h>
#include <propkey.h>
#include <d2d1.h>
#pragma comment(lib, "d2d1")
@ -84,7 +86,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 +131,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);

View file

@ -59,6 +59,7 @@ protected:
BOOL getTextFormat(int ResID, TextFormat& formatOut);
void showWindows(std::vector<CStatic*> windows, bool show);
POINT getMouseCoords(MSG* pMsg);
void MarkWindowAsUnpinnable();
bool _isConsoleRunning { false };

View file

@ -150,7 +150,7 @@ BOOL LauncherUtils::launchApplication(LPCWSTR lpApplicationName, LPTSTR cmdArgs)
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
// start the program up
BOOL success = CreateProcess(
lpApplicationName, // the path