aboutsummaryrefslogtreecommitdiff
path: root/src/ext/Util/ca/BroadcastSettingChange.cpp
blob: 2e153ad3cc5f7eb3b90fbcadac3160701728cfc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.

#include "precomp.h"


/********************************************************************
WixBroadcastSettingChange

  Send WM_SETTINGCHANGE message to all top-level windows indicating
  that unspecified settings have changed.
********************************************************************/
extern "C" UINT __stdcall WixBroadcastSettingChange(
    __in MSIHANDLE hInstall
    )
{
    HRESULT hr = WcaInitialize(hInstall, "WixBroadcastSettingChange");
    ExitOnFailure(hr, "failed to initialize WixBroadcastSettingChange");

    // best effort; ignore failures
    ::SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, NULL, NULL, SMTO_ABORTIFHUNG, 1000, NULL);

LExit:
    return WcaFinalize(ERROR_SUCCESS);
}


/********************************************************************
WixBroadcastEnvironmentChange

  Send WM_SETTINGCHANGE message to all top-level windows indicating
  that environment variables have changed.
********************************************************************/
extern "C" UINT __stdcall WixBroadcastEnvironmentChange(
    __in MSIHANDLE hInstall
    )
{
    HRESULT hr = WcaInitialize(hInstall, "WixBroadcastEnvironmentChange");
    ExitOnFailure(hr, "failed to initialize WixBroadcastEnvironmentChange");

    // best effort; ignore failures
    ::SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, NULL, reinterpret_cast<LPARAM>(L"Environment"), SMTO_ABORTIFHUNG, 1000, NULL);

LExit:
    return WcaFinalize(ERROR_SUCCESS);
}